by yabones · 4y ago · 0 comments
> The AWS account takeover was possible because a highly privileged IAM role had been assigned to the EC2 instance running the vulnerable Docker container app
The mistakes are, in order:
1. Binding an administrator IAM role to an EC2 instance, which is never ever a good thing to do, and
2. Running a docker container with full root privs - docker is not as much a security barrier as you think it is - it's only slightly better than running the application as root on the VM itself.
So yes, the log4j vulnerability is dangerous, but not nearly as dangerous as running everything as root all the time.
Because in an alternative universe, they could have chosen to treat log messages like SQL where parameters are passed separately.
Obviously some people must believe that logs should be trusted input, otherwise we wouldn’t be in this situation.
That said I consider both logs and error exceptions as untrusted input, but purely on practicality.
They did chose to do this. The vulnerability arises even when this is done correctly.
Pseudocode:
log("example: %s", userInput)
This is still vulnerable. The parsing that exposes the vulnerability occurs on both the format string and userInput here.Log4j is not java. In fact, you can have log4c# or log4rust or log4fortran with precisely the same design, and consequently the same design problems and vulnerabilities.
When was that, exactly?
I just grabbed by copy of CGI Programming on the World Wide Web by Gundavaram from 1996, and on page 368 it says:
> Most servers are set up to run with the user identification (UID) of "nobody," which means that your scripts have to be world executable. The reason for this is that "nobody" has minimal privileges.
Sure, there would always have been a few idiots who ran everything as root, but my recollection, backed up by the well-respected O'Reilly & Associates here, is that running internet-facing services with restricted privileges was the majority position for at least as long as web servers have had version numbers of 1.0+.