Live data from Hacker News

A capability-safe language would have minimized the Log4j vulnerability

justinpombrio.net

31–40 of 158 posts

Re: A capability-safe language would have minimized the Log4j vulnerability

#31
post #7

Except the vulnerability was a stack up. The logger wasn't making network calls per se, but passing requests to a component (JNDI) that would obviously need network access. You'd have the same root issue, it'd just manifest more as sort of a confused deputy with a capability based model.

[deleted]

Re: A capability-safe language would have minimized the Log4j vulnerability

#32

Personally I wonder whether anyone actually used log4j willingly or just because its generally used by all the apache projects and they wont start without it. With a healthy dose of "use the latest versions" mentality. I checked back and all my java code was still running log4j 1.1, and removing it has been on the todo list ever since it needed linking. You should be checking all your 3rd party source code, "capabili…

> Personally I wonder whether anyone actually used log4j willingly

Any project written in Java that has ANY dependencies will also use Log4j. Not even your choice anymore unless you are willing to write your entire stack from scratch.

The moment you start thinking about how to solve logging you will land at a log4j-like framework anyway.

> You should be checking all your 3rd party source code

How is that a usable advice? There are dozens of dependencies in a simplest application. A non-trivial may easily have above hundred dependencies.

Re: A capability-safe language would have minimized the Log4j vulnerability

#33

Personally I wonder whether anyone actually used log4j willingly or just because its generally used by all the apache projects and they wont start without it. With a healthy dose of "use the latest versions" mentality. I checked back and all my java code was still running log4j 1.1, and removing it has been on the todo list ever since it needed linking. You should be checking all your 3rd party source code, "capabili…

> the number of applications that dont need network access these days is as good as zero

You can still have all outgoing traffic be sent through a proxy that denies any target that is not explicitly on the allowlist.

Re: A capability-safe language would have minimized the Log4j vulnerability

#34
post #5

Does this interact with or preclude operating system level capabilities?

It interacts with well.

OS-level ones call the shots, but maintaining the same discipline within a process is a good way to write better code, (especially better libraries).

Re: A capability-safe language would have minimized the Log4j vulnerability

#35

Earlier quoted context omitted.

It still passes. Because JNDI would require network access, so log4j would also have to require network access or "disable" the network capability.

Practically (and like is being suggested here in other comments), JNDI would probably be a separate component (maybe a separate process) with network access, and log4j would just send those user provided strings over an IPC channel, and you'd be in exactly the same place at the end of the day.

Sure, it could be, but in a capability system if the application is starting that JNDI component, granting it network access, and granting the logger access to it:

1) It's pretty dang explicit to the programmer that they're granting the logger network access, because they're the ones writing that logic.

2) Even if you've granted the logger network access, you probably haven't granted it complete access to your filesystem. Network access isn't the only sensitive thing on your system, and a logging library needs very little authority to operate (specific files/directories and its own config?). Getting code execution in the logger shouldn't be game over security-wise, because it shouldn't have that much authority to begin with.

Re: A capability-safe language would have minimized the Log4j vulnerability

#36
post #9
post #6

Why should a programming language be limiting network access? Why wouldn't we do this via the operating system?

It might be useful that some code in a single process have access while other parts do not. How would you propose an OS handle those cases?

And how do you do that, without operating system support? I mean, you can't of course limit that based on the code, in the JVM there is only a single address space, thus every method or class can be instantiated from anywhere in the code (despite public/private/etc. that are only for programmer convenience, they are easily circumvented with reflection, they don't provide any security at all).

You can imagine doing something like adding some bytecode instructions that if encountered by the JVM block the network access to every other request done in the call stack after that instruction. Something that reduces efficiency drastically and still can easily be circumvented if you don't implement different address spaces for different parts of the code (something that only the OS can do).

Re: A capability-safe language would have minimized the Log4j vulnerability

#37
post #32

Personally I wonder whether anyone actually used log4j willingly or just because its generally used by all the apache projects and they wont start without it. With a healthy dose of "use the latest versions" mentality. I checked back and all my java code was still running log4j 1.1, and removing it has been on the todo list ever since it needed linking. You should be checking all your 3rd party source code, "capabili…

> Personally I wonder whether anyone actually used log4j willingly Any project written in Java that has ANY dependencies will also use Log4j. Not even your choice anymore unless you are willing to write your entire stack from scratch. The moment you start thinking about how to solve logging you will land at a log4j-like framework anyway. > You should be checking all your 3rd party source code How is that a usable adv…

I’ve always used the various log4j adapters and then excluded log4j from the transitive dependencies.

Re: A capability-safe language would have minimized the Log4j vulnerability

#38
post #6

Why should a programming language be limiting network access? Why wouldn't we do this via the operating system?

If your language is capable of expressing "this part of the code can't access the network", in a general way such that networking is not some special snowflake that's baked in, then you've created an effects system which is likely to be useful in many, many other contexts for other things you want to assert without having them supported in the OS. (For example, "is this code async", or "does this code print anything"…

That's an interesting idea. Although denying network to log4j wouldn't have stopped this I think, as it was the JNDI code that made the network calls, not log4j directly.

Re: A capability-safe language would have minimized the Log4j vulnerability

#40
Capabilities are underrated as a generally way to purge bad archictures, make it clearer what code is doing, and generally cut accidental complexity & improve programmer productivity.

This is a big deal, because many security practices are neutral or bad for programmer productivity.

We need a big project to get CloudABI implemented in all the major kernels to make the theory reality. Whereas before it was unclear what was a good candidate to get this stuff in prod, now it is very clear that socket-activated services are an idea use-case, with very little migration pain.

Even if you think we should be going to Fuschia or SEl4 or whatever, I think this is a good stepping stone. Those projects are a big jump alone, and funding is uncertain. (Plus there are issues of single-company dominance with Fuchsia.) I think CloudABI is the sort of "non-reformist reform" not "worse is better" stepping stone that would help those projects not hurt them.

Post reply on HN