010 - Inside the hex.pm Security Incident
Welcome to another episode of Macro Mayhem. My name's Peter Ullrich.
Today is November the 25th. It is 11:43
in the morning, and I am joined as always. Well, not always.
Last time you weren't here, but this time I'm yet again joined,
thankfully and happily, by my good friend, Gus Workman.
How are you doing today, Gus? I'm great, Peter. It's good to be back.
I'm here to keep you on track this week.
Exactly. Please do so. I gave Gus
a 300-kilometer-long stick that he can whack at me
when whenever I keep rambling on because he's in Luxembourg and I'm close
to Amsterdam. So it needed to be a very long stick. But, uh,
yeah, Gus, how was China in 3 words?
It was a good trip, very busy, and finally
back in on a normal routine again. So that's, that's,
that's the difficult part, you know, about those long trips, but.
Right. The routine and unfamiliar.
Situations. Did you, did you look at Nerve stuff or did you have any hardware
discussions while you were there or was it a family trip? It was
family, mostly family, but with the opportunity
of being in the same time zone with a lot of suppliers, had a lot
of opportunity to, uh, get some details
nailed down for components that my projects are ordering and things like that.
So, you know, Nothing NERFs related though. Will there
be a batch 27 or something? NERFs related,
there is now some movement
on the NERF starter kits. I had some,
uh, some of those suppliers that I was talking to were related to NERF starter
kits and some components and things are being ordered, finalized. So more
info on that one soon. Exciting.
All right. Well, let's dive into the big topic of this week. You've been busy,
Peter. I've been very busy. I'm very tired,
but nevertheless, you know, I'm going to give you the
highlights of what happened, which is the hex.pm security incident.
Oof. Oof. Big oof. Very big oof.
Yeah. I am, was, and still are, and will be
for a little bit still on the incident response team together
with Eric and Jonatan and José. Wojtek was a little bit
involved, but it was mostly the 4 of us.
Yeah, timeline-wise, Monday evening UTC
time, but like European evening, American morning,
Eric saw a lot of weirdly
suspiciously looking requests coming to hex.pm,
and he was notified by a Sentry error, well, by many Sentry
errors out of a sudden. Sentry errors like kept blowing up and they all had
kind of weird messages, you know, nothing you would like expect.
So he immediately started digging in and he found
out that hex.pm is under attack by malicious
requests and they were kind of probing with different ways of,
um, basically creating an RCE, a remote control, a remote command
execution on the Hex web workers. So the servers basically
that Hex runs on. Yeah, and we
believe now that they have been able to do so after thorough investigation.
We can't tell yet what they exfiltrated,
but just as a precaution, we have rotated all the secrets,
all the signing keys, except for the big signing key
that signs the— well,
okay, at this point, I can't I don't know 100%, but the
thing is there's a big signing key for the Hex package manager. And if you
rotate that one, all your Mix steps get, and particularly
the releasing of new Mix packages will be broken until you update
your Mix client. So we are waiting and we're actually working on
a new version of the Mix client, which will allow a
more seamless rotation of keys in the future if this
ever happens again. So that's one of the learnings. But yeah,
so right now you should still go into hex.pm
if you have a Hex account, even if you have a GitHub account,
like you signed in with GitHub to Hex, you should still go
in, rotate your passwords, rotate your 2FA secrets,
and that will also rotate your 2FA backup codes. So make sure that you
copy the new ones. If you have any API keys,
we do not believe that they need to be rotated
because they were stored not in plaintext, but as a
hash in the database, which has sufficient randomness
so that we think, well, even if they have now the hash of your API
key, it will take longer than the universe existed or
continues to exist to find the plaintext API
key. But if you want to be sure, just rotate the API keys
as well. There's no harm done there.
Um, yeah, that, that about sums it up. So,
yes. Um, questions? That is a heck of a vulnerability.
Yes, it was the first CVE-10.0,
I think, that I've seen, like a proper RCE,
like the highest level of vulnerability or severity
of a vulnerability assigned to Hex. We have now officially a 10.0.
It makes sense though, because that could compromise a lot
of things if malicious packages were pushed or things like that,
but As far as, uh, that you and the
response team is aware, there was no, um,
actually malicious actions taken, just perhaps
keys stolen. We can't say that with
high confidence, unfortunately. So that's why we are precautious.
We have taken precautions, rotated all the secrets, notified all
the users. We also notified the
users, and actually, like, there is a blog post that we linked
to, and there's an Elixir forum post about it, and you should also have received
an email if you're registered with hex.pm. I tried to
blast it on every single channel that I could think of, so you
might have seen it by now. If not, go to the hex.pm/blog domain.
Yeah, so we can't really say yet what was exfiltrated, and that's
a little bit the problem. Right. In, in the blog post,
we state that we have received a report,
a security research report shortly after we have seen,
or Eric has seen, the malicious requests. So that came like
30, 40 minutes after the last malicious request came
through. So we do have some
thoughts and ideas about who did it. And what
their intents were, but we can't say anything with any
confidence and also for other legal reasons just now. Right.
So that's why we are treating this as a proper compromise of
the production servers that potentially exfiltrated all the secrets,
all the username, uh, the user, well,
usernames, they're not that fancy because they're public anyway,
but user emails, user password hashes.
user 2FA secret hashes and
the 2FA backup codes and also the API tokens.
So we consider all of those compromised by now. What we can
rule out and what we have ruled out already is that
any, like, no packages were changed
in any suspicious way. I mean, there were package changes, but like from
these requests, we did not see that they changed any of the packages.
So we don't— Hmm. expect any malicious package to be now out
there. Mm-hmm. So generally, everything that
is not account-related, so packages, private packages as
well, because Hex also has a private offering,
we don't see that they were modified.
Now, we don't have all the data, we don't log all
the database queries for reading, for example,
private repositories, so we can't rule out that private
repositories on Hex were exfiltrated.
That might have been the case. Again, you know, we are working
on finding out what exactly was exfiltrated. But yeah,
so we just can't say with high confidence
that nothing that you would download on a regular basis,
so dependencies from Hex, has been modified
in a malicious way. Right. So at
least in terms of mitigation steps right now, the casual
user of Elixir, someone who doesn't publish any packages and
just runs mix steps.get in their projects, they don't
necessarily have any action items. They don't have an account on Hex,
so they don't need to rotate anything. However, if you do have an account,
they do. Then you should go in, rotate your password,
rotate your 2FA codes. Um, is that something that Hex
is gonna be able to like force library authors to do before they,
um, like push a package or, uh,
log in next time they must change those things?
Uh, that's a good question. I, I think,
yeah. Um, good question. I think that happened because we rotated some of the
secrets. So yeah, I,
It's something I need to follow up on, but I do believe that if
you try to release a new package and you haven't rotated, for example, your Twive,
you will have to redo that. But what we actually did is we locked everyone
out locally. So if you do mix hex.auth.login—
wait, let me get that one right. Mix local.hex.force
to updating. Okay. And yeah,
so it's mix hex.user_auth, or if you're using
Rebar 3, it's rebar3 hex.user_auth. So that
is something where you locally log in to your Hex or Rebar,
well, to your Hex account with OAuth, and those were
rotated, so revoked, so you need to re-login.
Again. Yeah. And that also, if you release locally, that is the
authentication method you're using to release
the package. Right. Yeah. So bottom
line, change your secrets, change your password,
change your 2FA secret, change your 2FA backup codes.
Basically, you just copy the new one. Right. And re-login with
maxmix@hex.pm/user. Both.
Right. And at the end of the day is that it will force you to
do this, right? Because, uh, you can't publish a package
without those new 2FA codes. Yes. Yeah. So that's
good. At least, um, since the codes have been,
or since the keys have been rotated, the chance of malicious packages
being pushed is low. Yeah. Yeah. We,
we, we feel pretty confident about this.
But again, we take precautions and we try to make this
announcement as widely available as possible. Yeah, it's a big
one. One, sorry, Gus, to interrupt, but one thing
that you should watch out, even if you are not logged into Hex or you
don't have a Hex account, if you run mix deps get
against a mirror of Hex,
so you don't download the packages from hex.pm.
Directly, but for whatever reason you're going through a mirror
or a proxy or cache or whatever that
is not run by the HACS team. So something maybe private, internal, or third
party. Don't trust those for now because,
because, you know, some secrets might have been compromised that would allow a
person to set up man-in-the-middle attacks in this regard to, yeah,
fake HACS signatures. So make sure that you
go directly to hex.pm, but if you just run mix deps get
locally without any custom configurations, it should do so.
It should go directly to hex.pm. Yeah. So check if you have
one of those weird configurations, although I think most people probably would know. You would
probably know about it. Yeah. Because it's a company internal thing or whatever, but just,
you know, keep that in mind. Yeah. Then, so can you dive into
a little bit about how the attack happened, because the
blog post that we've linked, um, actually does discuss,
uh, the vulnerability that was exploited, right? But, um,
let's hear it from, from, from your
perspective on how this was discovered and, and everything.
Yeah. So, so there were 2 ways of this, 2 timelines that we need
to discuss. One of them is the actual timeline of the attack,
and the other one is a more technical Not timeline, but a technical
playbook of how the attack worked. And I think the second part is very important
because we have seen the same form
of this attack, the same form of vulnerability in other
libraries. Hex and Flop, for example,
were 2 that already fixed that. And I also know from
other sources that there were companies who had products
that had this vulnerability. I don't think they were
attacked in any way, but just by knowing about this vulnerability
and also creating a CVE of 10.0 attracts attention
from actors that are, yeah, just outside actors
and potentially malicious actors. So make sure that you take the
learnings and the description of the vulnerability and
just scan your own source code with it and make
sure that you're not vulnerable to this. And The big function you
can search for is the PlugCrypto::non_executable_binary_to_term.
If you run this anywhere in your codebase
with third-party or outside input, even if you
think it's fine and you authenticated a person,
just don't. Just make, like, try to get rid of it.
If you can, if you can't, at least
make sure that, like, if you decode
the input, so you have some client input and you run it through non-executable
binary to term, make sure that you check that the output of
it is not a struct. Because the
vulnerability here, maybe we start with that one first. So let's back up a little
bit because we're getting into solutions. Let's look at the problems.
Yeah. So yeah, I'm going to explain how the vulnerability
worked, because then you can go off and find your code,
scan your codebase. In general,
the crucial part of this vulnerability was
that the PluckCrypto non-executable binary to term allows
an input or decodes an input into a
map. And a map in Elixir can
hold a __struct__ key and fields,
which Elixir interprets the map as being a struct.
And that is the critical point here. So if you can decode
a map with that __struct__ key,
Elixir will think, oh, the decoding value is a struct.
Okay. And at this point, an attacker can create structs in
your application. Now— So, so quick question
to tie this back to Hex. Where does Hex bring
in that external data and call this, uh— The
function? Yeah. Yeah. Hex has a pipeline
where they accept a Beam, an Erlang
Beam binary. And they do
parse it before they authenticate
a user. However, they thought because they use non-executable
binary to term with the safe option enabled,
they would be safe. And yeah, I mean, you can decode stuff,
but in this regard, yeah,
the decoding part was the issue. So the issue here was basically
that they decoded input,
like into a struct. And then, okay, you have a struct
variable and you might think, well, I then have the rest of my pipeline.
So I'm doing authentications. I do like checks
that this value, the input is actually like a map of string
keys that I'm expecting, some, you know, JSON input or something. So then you
would think, oh, well, even if the struct now exists, It won't
reach any downstream code, right?
Because I have a controller that would just send an argument or
undefined function error when the struct is sent
to the function. And that is what happened here as well. And that is what
triggered the Sentry error. Because once the
struct was actually decoded, it just caused a function
error, a function clause error. Mm-hmm. And that's fine if
you think, well, okay, the attack is stopped at this point.
But the second part of the vulnerability was quite interesting, and that is something you
should also keep in mind now that we know about this.
The second part of the vulnerability is that we have protocols
in Elixir that call functions on structs and
other input whenever they're globally executed.
So if you think about the inspect protocol that kind of
stringifies any Elixir Erlang term,
into strings that you can log, that you can send to Sentry.
It's the same thing that works behind the
scenes on the IEX console, io.inspect. You can throw
any data type in there and it will try to put it as a string.
Exactly. So yeah, the inspect protocol is implemented,
for example, for structs, right? So you can just do logger.info
and then you do inspect around your variable and the inspect protocol will convert
the variable, which might be a struct, into a string version that logger can
And then put into your logs. And this is where the second part of the
vulnerability came in, because if you craft the struct in a
very particular way,
um, the struct can call the
inspect implementation, and then the inspect implementation
will take the implementation of that struct type.
Mm-hmm. And in this situation, it was an Acto::Query::DynamicExpression.
So that was the struct type. And inside that dynamic expression
struct, you had a binding field, which would have
a list of bindings. And the inspect
implementation would then iterate through that list
of bindings and try to stringify those as well, so that
the whole nested struct can be converted into a
map or eventually a string that you can log.
Right. And at this point, the issue was that the
dynamic expression had,
yeah, this list, but it never really checked— sorry,
actually in the binding field of the dynamic expression, there was yet another
actor, another struct, which was the
DBConnection.Stream struct. So now
the inspect protocol would call the enumeration on the binding
field, which would be a DbConnection.Stream.
And then for enumerating this stream struct, it would
call again another protocol, which is the enumerable implementation,
right? So it's all like implementation
call, protocol calls on different types of struct.
first inspect and then enumerate, uh,
until it hit this DbConnection.Stream struct. And then inside
there, there, there could be, uh, certain functions
basically defined. So, you know. So to be clear, it's not
that they were able to ship the protocol
implementation in their specially handcrafted,
um, agent crafted message, but rather
that they were able to set the struct. And then this inspect protocol
was already compiled into the app because that's just part of Ecto. Exactly. Part of
how Ecto does debugging with inspect and all that sort of nice
to have features. So it was not like a vulnerability in the
code per se, but it was a vulnerability to craft the struct
in such a way that it looked like an Ecto struct.
Yep. And then that actor struct was inspected and part of that inspect,
also how it was specially crafted, was to eventually
get to a database query. Um, not particularly.
It wasn't a database query. So yes,
you first had the inspect protocol on the, on the actor type,
on the actor struct, but then inside the actor struct, there was
a binding field, which was thought to be a list. And You know,
inspect would just enumerate that list to check, okay, what's inside this
list? But it, uh, it was not a list. It was another struct. In this
case, it was a DBConnection.Stream struct. And then inspect
would call the enumerate protocol on that .Stream
struct. And the stream would just iterate through whatever it had in its
stream. Ah. So inside that,
inside that stream struct, you can now create, you could have function
calls and you always have triples or tuples of
module, function, and the input variables.
So, you know, and that, and then because you enumerated that
and it would call this tuple of module,
function, and input arguments, and this way you could execute
any function that you wanted. Any arbitrary code. So it's, it's quite the
chain of events that happens to make this
possible with systems generally working as they were intended,
but with one data parsing
flaw in that, allowing the struct in, in the first place.
Yeah, it was really interesting. Uh,
yeah, for these 2 reasons, like one of them is that you can create structs
with the non-executable binary to term.
And the second reason was that we don't think about
protocols when we do our security research because it's,
it's a functional language. So you only really think about which function
is called next. You go through the function call stack and then you
can basically say whether an attacker has a theoretical or practical
way of calling certain functions. And if they're not in that function call
stack, you just assume that it's not possible for them to call A downstream
function, but with protocols, it's kind of the OOP
problem where, you know, any function,
like there's a global function somewhere, like a magic function in the cloud that
out of a sudden gets called if you do the, for example,
inspect function. Yeah. I mean, I think this is probably too
early to say, but do you think that there's going to be any reconsideration
to how these protocols work given this, this attack? I don't
think so. No, to be honest, I don't think so. I think that
we need to, I mean, first of all, this is a new class of vulnerabilities
that we've seen. It's very interesting, but it's just something
that yet again now is publicly known,
and we need to make sure that we scan for that kind of stuff and
we check for this kind of stuff. Right. But again, like protocols are
so baked in and they're so useful, I wouldn't want to rip them out anyway.
It, this, this is not the right learning from it. It's more like,
you know, previously you knew that binary_to_term or string_to_atom are
very dangerous functions. Well, now you should put non-executable binary_to_term
on that list of functions as well. Right. Because yeah. And,
and if you do use it somewhere, just don't, just don't use it. Just do
JSON encoding. It's fine. That brings the question
is why was Hex using this specific Uh,
binary, non-executable binary to term. What was the data that
required it to be non-executable binary to term rather than JSON
or something like that? I do believe it is to support older ways
of releasing dependencies that now they
come as JSON, but previously they came as an Erlang, um,
term or like an Erlang binary that then would be like
converted back into a term. That's just an old
artifact of how the previous version of Hex clients worked?
Yes. Yes. So latest versions, they use JSON.
Older versions of the client still use the, uh, Erlang binary type.
Man, it's such a powerful encoding type,
but that encoding type comes with a lot of considerations
that is hard to, to manage from
a security perspective. That's the reason why the industry kind of decided on JSON.
You know, it's, you can, you can, uh, you have a certain set of
types that you can send and it's all strings
until you decode it safely, you know, and then you can
decide on what is safe and what is not. And if you just say,
oh, just create any, any, uh,
language type that you want, you know, that,
that is, that is the unsafe part of this. That's what binary to term does.
What do you mean I can't send functions over JSON?
Well, you could still, right? Um, but you have to decode them yourself.
Exactly. And then you could say, well, there can only be a list of certain
function names with certain arity, that kind of stuff. Right.
So it, it's, this is quite the vulnerability.
It's, um, I'm just incredibly
in awe of, of you and the Hex team getting this response time
down to, I think your blog post said 20 minutes or so. Yeah. It was
like 15 to 20 minutes until the fix was fully released. How much
of that was like kind of luck? What,
what if this happened in the middle of the night? No one was monitoring those
Sentry errors. Yep. This would have,
um, not been fixed within 15 to 20 minutes.
I mean, uh, the, the issue that kicked it all off was
a Sentry error and then not one, but like 60,
70 different errors. Right. Coming in, in a very short amount of
time, and they all looked suspicious. And luckily, Eric was at his computer.
He got the notification, he jumped right on it. And then,
I mean, agents played a huge role in this as well, in the fix
and the investigation, also in the
process afterwards, like the announcement, the blog post, the analysis
of the logs, analysis of all the data that we could gather.
Yeah. Like without that, it would have taken much, much longer to
compile our findings, to understand what was happening, to get
the fix out there. So. And this, this goes
again, I think, to, uh, we talked about this a couple episodes
ago that, um, the hex.pm and the EEF CNA
is just really one of the best, um,
CNAs that are out there in terms of responsiveness and the issues,
the quality of the findings and the quality of the fixes that, You guys have
done huge kudos to you guys. Clearly there is no one better
to be running, uh, the security of our
ecosystem and the BEAM ecosystem at large. So,
um, huge kudos and I commend you all for
that. Yeah, thank you. I mean, I'm, I don't, I do
think there are better teams than us for sure. Um, but what I see
is that the quality of the incident response, the timeliness, the speed,
Uh, the level of transparency we work with and also just the,
the professionalism of the response. Right. Um, all of that are like,
I saw levels of quality here that I would expect
only from high performing, performing, uh,
professional teams like at Microsoft, you know, and we got,
we have that capability and the competence of
these people in-house. And unpaid,
like partially. Should we run the EEF funding
spiel? Sponsorship. Yet again. This is all
unpaid work. Send money to EEF. I mean, not fully unpaid, you know,
like Jonatan, the CISO, gets paid for his work.
I get paid for different work, but, you know, I consider it part of
it, just generally be available work. I'm not sure about
Eric, but generally this was not the work of fully
paid and employed professional teams, you know, highly paid teams.
It's not the security team at Microsoft that has
their full-time salaries to only look at logs and perform
security incident responses. This is a community effort,
first and foremost, um, that happens to have a little bit of funding behind it,
but really needs more. So, yeah. So yeah,
if you haven't yet, you know, you can go to, uh,
sponsor.erlleft. You can become a company sponsor,
but also if you're an individual, it is very much appreciated if you sign
up for the EEF membership of $100 a year.
That also helps, um, you know, just like a little drop
in the bucket, but every drop helps. And it also just gives us more
negotiation power at the table where we can say we have X amount of,
um, paying members of the EEF. Right.
Yeah. So. That's a big one. It is a
big one. Uh, it's still not done yet, so there will be further follow-ups.
Uh, if you want to follow them, ideally, yeah,
there is an Elixir forum post that I made yesterday. So if
you follow that one, I will put all the latest updates there.
We will also release the updates on the hex.pm blog
and generally on all the different channels. But I think the Elixir forum post,
that, that is where the Like, I will at least put all the information that
we're gathering. Um, again, the incident is
mitigated, but we're still now in the cleaning up process
of finding out what exactly was exfiltrated, uh,
and that kind of stuff. Right. Well, everyone keep
an eye on that. The Elixir forum link is in the description.
So I think it's pinned on the Elixir forum as
well, right? It's right at the top. Yeah. Yeah. It's the hex.pm security
incident. Hello. I wanted to quickly jump in here to answer a couple of
the questions for which I didn't have the answers on the spot during the
last section. So the first question was, did we force logout
users both from hex.pm and also locally? And the answer to that
is yes. By rotating the secrets, all website sessions
were revoked and also all OAuth sessions
locally were revoked. So now you need to log in back into the website
and also locally with mix hex.user_auth to
log in again. Next question was,
must people rotate their credentials, so their passwords,
before they can release new versions? And the answer to that
is no, you don't have to rotate your password before you
can release a new version, but you should rotate
your password. But the reason we didn't reset all the passwords,
which would've caused everyone to be forced to reset their password,
was that we thought that only weak passwords can
be attacked right now. So they can be found out by brute force.
And if you have a strong password, then you would be
okay. You know, if you have 40 characters of really random
characters, it's very hard to brute force that password. So we didn't wanna
make that decision that every single password can be attacked right now.
And that's why we didn't reset the passwords, like force reset
them for the users. And that means that you can still release new versions with
the old password, but again, you should rotate your password. Next question
was, what was that big signing key that we haven't rotated yet?
That big signing key signs every single resource
that you download from hex.pm to your local computer. So every time
you run mix deps get, It downloads the resources
and then it has the public key to that signing key in
the code. It's baked into the code and it verifies the signature
of the resource with that public key. And this is
mostly a prevention if somebody is in the
middle, like a man in the middle or a cache or something in
the middle would change the bytes as they come
from hex.pm to your local computer. And by signing them,
you know, you can on your local computer make sure that this
is actually the signed bytes that you, that Hacks sent you.
The issue with that is that the public key is hardcoded into Mix right now.
And if you would rotate that secret, the big signing key,
every single Mix deps_get would fail unless you force it
or you ignore that check basically. So that's why we are
working on a new version of Mix, which will allow multiple
public keys and fall back to the next one if one doesn't
work. And this way we can also rotate keys easier
in the future. So that's about to come in the next few
days. Last question was, why did Hex accept this
MIME type of binary Erlang binary terms where
people could send binary Erlang terms? Why did they accept it?
And the answer to that is that it was necessary to support
older OTP versions like OTP24 that
did not yet have JSON support natively,
so built in. And in OTP24, if you wanted to release
a library with OTP24, if you wanted to build that library and release
it on Hex, the only option you had was to either include a JSON
library to then do the JSON work.
But we didn't, you know, Hacks didn't want to force that on everyone who wanted
to publish an OTP version or like a library in general.
So they also supported the Erlang binary term, which OTP24
understood how to create and decode to, and then
use that to send the library to Hacks.
But that might also change in the near future where
that support is being dropped and then JSON is the only option to,
to send packages, but that is something for the Hex team to decide.
Just a little bit of background on why they accepted this in the first place.
All right. Those are all the questions. And, uh, thanks for sticking around.
And now let's continue with the show. Well, I think this
security incident was a big one and it kind of overshadowed that
we had some more CVEs in OTP itself as the next news item,
right? Yeah. I mean, this has been,
Security Tuesday, Patch Tuesday, basically. Uh,
yeah. Also OTP released new versions because they themselves have
a bunch of CVEs. Um, you know, now this fix,
this version 29.1.3, and also 28
and 27, their versions out, fixed versions, all 3 of them close 9
vulnerabilities that have been reported. 3 of them were
caused by binary_to_term. So, huh, look at that.
So yeah. Um, maybe don't use binary_to_term ever
again in your whole life. Yeah. And there was even an EEF
blog post that we also linked in the description about stop using binary_to_term.
Exactly. So if you didn't get the message
yet, really stop using it. Just stop. I mean, string_to_atom shouldn't be used.
binary_to_term shouldn't be used. And now also new in the list,
non-executable binary_to_term, even with a safe option,
don't use it. Yeah. Right. Just, just don't.
I think, I mean, we're kind of,
if there's any other notes on that one, I think the next
interesting point is that there are new audit tools, right? Exactly. That can help you
catch these things and catch your uses of binary determinism,
non-executable binary determinism, whatever is
next. So the 2 tools I added here, one, I saw them on
Elixir forum and I wanted to point this out because with all these CVEs
coming out, They seem scary at
first, but eventually you might just not be vulnerable
to them, even if they are in a library that you're pulling into your application.
And the key factor here is that if, like, sometimes a CVE
is caused by a certain function that a library offers, for example,
PluckCrypto::NonExecutableBinaryToTerm, right? I'm going
to repeat this until I'm in the grave, 6 feet under.
But yeah, so sometimes a CVE is for a library that you pull in,
but you don't use that particular function that has the vulnerability.
And until now, it is, yeah, you would need to do a regex search for
that particular function to understand whether you're actually using that function.
And there are 2 tools that came out. One of them is called
beam_audit, and the other one is vulncheck,
like vulnerability check, and we'll link to them here in the show notes
too. And they both, first of all, check OSV
and the, the hex CVE records. So they check
your libraries against public CVEs, which also
Mix already does for you. But more interestingly, the 2 libraries,
they compile the AST of your application and
then scan the AST whether you use
the actual function that has the vulnerability or not.
So this makes it a little easier for you to understand whether you are actually
affected by CVE or whether it doesn't affect you and it doesn't need
that much of attention right now.
So just wanted to point out that these 2 tools are coming out
and also the EEF is in
the planning stages of more and better
tools that you can use, for example, as part of Mix,
but also maybe it's a separate library. Um, that would make it
easier for you to check your actual code, whether it calls these kinds
of functions. So there's still, I think this is the next level
of actually like making the, the process of,
um, checking CVEs and fixing CVEs better. But yeah,
these tools are 2 very interesting, uh, stuff. And that is
in addition to the tools that we already know and love,
Credo, Sobelow. I think we add Argus
to that. Did we talk about Argus before? I don't think we have, but we
should. I also used it yesterday to find 2 bugs. Argus is a very interesting
and exciting new tool by Quinn. She created this tool that
scans your codebase in a static way. It's not an LLM
scanning your codebase for vulnerability. It is very much a static analysis and it's super
fast. And it can find certain types of vulnerabilities
like race conditions or Um, memory exhaustions
where, you know, you might just create a million processes that way.
So it's yet another tool that I would just put into my pipeline
to, to scan my code. Yeah. All these are really good things
to add, especially in this day and age. You can really
just create a skill and ask your agent to run them or run them
on pre-commit. Like it's— Exactly. It gives
you that peace of mind to sleep at night, right? Yeah. And it's fast enough.
Like it's not a security scan that takes 15, 20 minutes. It's a,
1 to 2 second scan. It's very fast. Right.
And next, uh, now talking so much about security, we should head
over to our sponsor, Michael Lubbers from Paraxial.io,
with the security question of the week. All right.
Welcome back to this week's security question with Michael, the founder
of Paraxial.io. Michael, this week we want to ask more on the
diagnostic side. If your app gets hacked, what types of logs,
telemetry, and other data do you look for to analyze
what exactly happened?
So that's a good question. And it's very common now that this
gets more of an issue. So let's say you have an Elixir application, it's deployed
on the public internet. Somebody found it, kind of probed it. They tried a
few attacks and one of them eventually worked. And they
got access to your server. And maybe you discover this because, well,
we'll have cases, it'll be like a crypto mining thing. You'll get an email from
AWS or Hetzner. In some cases you don't discover it.
But for, for that type of attack, what you would want are
really like logs from the HTTP requests coming into the server.
And you could do that at the load balancer layer. You could do that within
your Elixir application. For example, like incoming cons
and routes, you know, somebody's sending like an obvious SQL
injection string or like an obvious attack payload.
That's something Praxial can work on as well. I mean, this is a whole category
of security products. For example, you could do runtime
instrumentation, which uses a Beam feature to
monitor for certain functions. And if you see a certain behavior
at runtime, That's a strong signal that you are being attacked.
And then what bad guys typically will do is they'll install cert—
like software on the server, for example, to mine cryptocurrency.
So you could do like file integrity monitoring or
have logging of, let's say, if a new package is installed
in production, or if somebody SSHs in, or the SSH keys
change. Do you have some kind of log that is pushing
that out to your logging system? Do you have an alert that's
set up that goes to a human? You can even send it to an AI
now. Um, I think most people are doing that for triage.
Um, that would say, hi, um,
we were, I was looking at your logs this evening. I saw a pattern of
malicious HTTP requests from this IP that's known to be malicious.
We also detected this runtime behavior. And now your SSH
keys changed. It's kind of like this, okay, 1, 2, 3,
4, and then you get that Slack message. It could be the individual
ones or maybe an AI summary, um, of what
happened. That's far better than just
being completely blind to what's been happening.
Very interesting. So logging instrumentation,
definitely really important and being intentional about where all your data's
logged. All right. And we're back. Thank you, Michael,
for your expertise and wisdom as always.
Next, Gus, what do we have on the list?
Looks like a state of, like a survey to me.
Yes. The State of Elixir survey is open and
it's open for another 5 days as of recording, maybe a little
bit less if you're listening to this later this week.
State of Elixir survey is something that's been run the last couple of years,
kind of similar to the Stack Overflow Developer Survey, but really focused
on our Elixir and BEAM ecosystem. It's run
by Curiosum, the Elixir consultancy
out of Poland, I believe. And they have been a big
contributor to the community for these last couple of years. They publish the
results, I don't know, a couple of weeks after the survey closes.
Uh, they compile them up nicely in a nice report. So if you are an
Elixir developer, which I believe you are, if you're listening to this podcast,
then please go fill it out, make your voice heard. Let us know,
let the community know what is important to you, what things you're
paying attention to. Um, have you filled it out yet, Peter? Not yet.
I'm going to do that right after we finish recording here,
right away. Yeah, same, same here, but It
is, it is an important one to gauge where the community's at. So please
take a look. And the next item is a little one that
I want to highlight. It's called elixir.land, and it is a
pretty interesting registry of companies that use Elixir and
maybe even Erlang. And it is compiled not
on self-reports, because there are many, I gotta
say, there are like 10 different company registers for Elixir and BEAM companies
already out there. I forgot all of them, to be honest, except for
the EEF one. But this one is interesting because
it uses LinkedIn data to also fetch information about the
company size, like the headcount. I think even the
revenue, if they, if it's public. And also
it lists the team size of the Elixir team. It's all estimates
from LinkedIn, obviously, but it gives you a good overview of which companies
have larger teams using Elixir,
smaller teams using Elixir, headcounts, locations,
um, and in which industry they work. So I just thought it was a
nicely compiled list. It's a good follow-up to,
uh, last week's monologue about getting hired in
Elixir. So if you are looking for a job, maybe peruse some of the companies
on that list, see if any of them are hiring. Yeah. And I didn't know,
like, probably half these companies. Have you ever heard
about cabify.com or, yeah,
thescore.com? There's, there's some interesting ones
there. So, um, and, and they are,
uh, ranked in terms of what size of employees
or something? I think Elixir team size. Yes. But you can, you can rank it
in different ways, I think. Right. Very interesting.
So, yeah, I mean, some of these, I don't, a lot of these I don't
know. in general, but some of these I, I recognize,
but I don't know that they have. Exactly. So interesting
little list. Yes. Now, Gus, I'll let you do the marketing
for something I built. I actually
use this already, so I can do this very well.
Um, last week, was it last week? Peter posted that
while he was waiting for his agents to do something,
something unrelated, probably some security work or something,
he decided that his disk space was too full and created
a little library, not an Elixir one, but a Rust one,
uh, to sweep away all the cruft, um, and clean
up some, restore some disk space to his hard drive,
his SSD. I'm guessing it was suffering at like 98%
or something. I have a MacBook with 500 gigabytes and I'm constantly
at 495 gigabytes and I feel that.
Yeah, actually. So, so the library is called Broom. It's a small CLI
written in Rust, not Elixir, but it's very nice. I think you
can just run it on any like folder or parent
folder or all the folders of all the software projects you have.
Uh, and it will find all the typical cache and build folders,
like, you know, _build, deps folders,
rust_target folders, and it even has like JavaScript node_modules.
Hmm. Java, C#,
.NET, that kind of stuff, like Go. So there are many different
folders it finds and it lists them for you nicely in a list that,
uh, where you can select folders to, to remove. Yeah,
that was the nicest part is that you can not only see them, but you
can then scroll down the list with keyboard navigation.
Of course, since it's a tool, you select space or to,
to select the folder, it puts a little checkbox or an X next to the
box. And then, and then at the end you just tap enter, you confirm,
and off to the races you go. Off it goes. Yeah.
And the coolest thing about this, I think at least, is that it doesn't only
find these folders, but it also checks common tools
like asdf, or mise, or whatever the French
name is. Uh, because I, for example, found that I had quite a few outdated
Elixir versions still installed on my system with asdf, and I You
never go to the ASDF cache folder to remove them. So Broom kind
of understands, okay, there are a couple of tools installed and it just scans the
cache and the build folders of those tools as well. And if you
have any particular tools you want to add, there's a very easy configuration you can
just add them to and it will find those as well.
Very nice. Now, I do have to ask is
that you shared a really nice little Um, image of
your output on LinkedIn or not LinkedIn on Bluesky. And,
um, I saw that I had that little
output on my terminal, but how did you make your images? How was
it so nicely formed? Like, I, I love the little shareable aspect
of it that you can say, oh, look, I swept away this many gigabytes of
unused stuff. Exactly. That's how you do guerrilla marketing. Yes,
it's guerrilla marketing, but I need, I need either like a, render this to PNG
so that I can save it in my downloads and then upload it to Bluesky
or something? Or what's the tool you use to make that screenshot? I have no
clue. I have no clue. But I told Claus to do that.
I thought, well, you know, what we need is a nice shareable output
that also has the Pushin link at the bottom, you know, just an aside.
But yeah, so that you can share it with your network. But I think it
uses a certain library. You can look at the code. It's on Pushin. It's open
source. Yeah. Yeah. Well, I need, I need the PNG. There you go.
But yeah, like little trick, if you want people to adopt your language and it's
useful, add a nice little shareable output that they can screenshot
and put on their social media prof— uh, posts and whatnot, the platforms.
Yes. Good. Like, like the Wordle. Like Wordle. Yeah. That's how
they got big, you know? That's how they got big.
All right. Well, Peter. That's it for the news, right? Yep.
Let's move on. So let's hit some blog posts.
We just have a couple this week. Um, it's been
a busy time for news, not so busy for Nerves, for blogs,
but a couple of good ones. First up, Lars Wieckmann.
Uh, everyone knows and loves Lars. He is on Nerves core
team and he posted about how he uses Nerves.
With real-life examples of all the crazy devices that he has
come up with. And I guess more so,
I feel like Lars is kind of at the center of a web of nerves.
He's really good at tying people together through conferences and just,
he's really good at encouraging people to get out there and show their stuff.
And that means that he collects a lot of hardware from various people,
including myself. He posted about the The Nerves
starter kit robot running Beam bots on his blog post. There's like a Nerves
phone that he's been working on based on the work from Marc Linné.
Um, he's got a Nerves watch, also done that
where they've hacked an Android watch to put Nerves on it.
Um, there's a whole bunch of stuff. It's really
cool. If you haven't looked at Nerves in a while, like, I think I mentioned
this a few weeks ago, is that there is an explosion of the number of
devices that Nerves runs on these days. And Lars's post
will give you an idea of some of the cool ones. Yeah. I'm always so
jealous. I, you know, if I wouldn't do security and pushing,
I would, I would try to only do hardware all day long. You know,
I would try to find a job with that because it's so cool to work
with physical hardware that you can make blink and, you know, track sensor
data. And, uh, it's such a cool extra layer to,
to writing code. Well, I gotta say,
This reminds me is that when I was in China, I found
a, um, a, like a retro
gaming console kind of inspired by like the Game Boy or something like that for
the low, low price of like $13.
Um, and it runs a full Rockchip chip inside
of it. So it's like, it's a quad-core chip with a nice pretty screen and
a bunch of buttons. Um, that thing's going to be Nervesified
soon. So I need to join in on some of this fun. All these people
I've been seeing have been putting nerves on crazy places. That's my
goal. So maybe I should do that. Retire and then fly
to China 3, 4 times a year, go around the markets and just pick
out these really cool gadgets that you would not find anywhere else for, you know,
peanuts. And then just put Nurse on all of them.
Yes, that would be— That's my retirement plan. There you go. In the meantime,
until that happens, go check out Lars's blog post because
he's having that fun. Oh man, look at him. He's living the best life.
Yeah. Indeed. All right. The next and last blog post for this week
is, uh, yet again by our serial perpetrator,
Johanna Larsson. Uh, she wrote about something that I already
told you about, but I thought if you hear it from her, maybe you would
be finally convinced because she did that in really nice elaborate ways,
which is that you should not store your SSH keys on
your local disk. And she writes about exactly
the issue where if it's on your disk, even encrypted, it can be exfiltrated
if somebody gets access to your machine, which now agents,
they run locally on your machine sometimes, and they might just do that by accident
even. So yeah, she tells you how to do, how to
move your SSH keys from local disk to Bitwarden, I believe is her password
manager, but also other password managers like 1Password, ProtonPass,
probably all of them by now support SSH keys.
And then they have a little agent running, a little SSH daemon
on your local computer. Is that how you say it? I always thought it was
daemon, but it's daemon, right? I say
daemon. Daemon. I think daemon sounds a little too dark. Is it? I think
because it's an AE, daemon is EA, so it's a
different word than daemon. But I would also say a little daemon runs on your
computer. I think you probably can say it both ways. Okay. I would
say daemon. Yeah. I'm sure there's some like retro computing
history for the— If somebody knows that, I would be very curious why it is
daemon or daemon. Daemon or not daemon.
So a little program, a little process. What was
my point? Yes. So it runs on your computer. There's a little SSH agent
that exposes then the SSH key to,
yeah, Git, for example, when they need it or SSH when they need it.
But the actual key still lives on your, just in your password
manager, not on your computer. All right. And those were
the blogs. Now, Uh, Gus, we have a few conferences and meetups.
Should I— You got your timer ready? I will, I will time you. I never
know what is on macOS, but the stopwatch. I will reset.
3, 2, 1, go.
Alrighty. First up, FOSDEM, the conference in Brussels
in, I believe, February or maybe end of January, has the call for
talks that closes on December 3rd. We have a BEAM room at
FOSDEM. And that, I think, is where these talks will happen. Check out the
link in the description to submit a talk. ElixirConf EU,
which is in Lisbon on April 22nd,
23rd next year, has their call for talks open. That closes
on December 15th, so about 2 and a half weeks from
now. Link in the description to submit your talk. We want to see those.
Everyone should submit a talk.
Additionally, there is the Elixir meetup in Melbourne. If any
of our Aussie listeners are tuning in, and you're in
Melbourne or other area, December 3rd, there's a link
on Elixir Forum to signing up, link in
the description to that. And finally, Nerves meetup EU,
my little pet project.
December 9th is our next meetup. It is remote via Zoom. We were talking about
BeamBots on Nerves with the presenter, James Harton, and our lovely,
uh, social hour discussions afterwards. Come for the presentation and
stay for the social hour. It's a good time. Perfect. 1 minute, 15 seconds.
I think that's your best time ever. Best time ever.
And that was a lot of content. Yeah. Yeah. You're getting better every 2 weeks.
Yeah. Thank you very much. Well, let's see if you can
also improve every 2 weeks, Peter. How's your joke this week?
It never gets better. It only gets worse. So,
uh, well, that's a trend as well. Maybe that's the metric. Maybe. Let's see.
So, you know, last, last week I was walking
down the street and some guy, because I'm in the Netherlands, obviously, right?
I was walking down the street and some guy threw a block of
cheese at me. How dairy.
Oh, Peter, that wasn't very Gouda. No, not very Gouda.
Okay, I have another one. Uh, why do
people with a foot fetish like to lose?
Because they like defeat.
Okay. Okay. That's, that's better. Good.
That's better. And on that high note of enthusiasm,
happiness, euphoria,
I guess we need to call it a day. And,
uh, this has been Macro Mayhem on the 25th of November,
2026. Thank you. To any of our US
listeners, Happy Thanksgiving this week. If you are tuning
in, uh, we appreciate you. And I don't
know if you noticed, Peter, but this is also our 10th episode. So double digits.
Congrats to us. So now we have that sorting issue
where like the next 11 comes before
the first one again, if we don't do proper sem version sorting,
if we just do alphabetical sorting. Yeah. Well,
gotta figure that out. Yeah. I mean, I gotta say after 10 episodes,
the people who work the hardest on this is our listeners, right? They had
to sit through all these minutes and hours day after— And jokes.
And jokes, 2 weeks after 2 weeks, like regularly.
Do nothing except for staring against a white blank wall, listening to
our voices getting into the brain. I gotta
say, yeah, so kudos to you all out there. Thank you very much for tuning
in. And, you know, hopefully, oh, now our next exponential,
like, growth will be the hundreds. So now we're going
from 10 to 100 in the same time that it took us to go
from 1 to 10. And then we have to go from 100 to 1,000.
So if we soon get episodes every 10 seconds.
Oh my, this was not communicated to me, Peter. It's, it's,
I would call it Peter's Law.
Peter's Law. Like Moore's Law is already gone. So let's
just make it Peter's Law. I think that's what Peter's Law is already.
Yeah, probably. There are many, there were many smart Peters out
there before me, so probably.
Okay. Well, anyway, thanks listeners. Uh, have a
great day. Sorry for all the security incidents, but, uh, I hope you are
getting through it. You know, if not, send us a message and so
that we can ignore it, but we appreciate you and we
wish you lots of happiness and a happy Thanksgiving to the people on
the other side of the pond. And we will come to you again
in 2 weeks.
Bye-bye.
