Skip to content
Race condition Write-up Advanced

Expand file tree

The Amazon Linux log4j hotpatch service ran a process's executable as root when checking its Java version, so an unprivileged user could plant a malicious binary named java and have it executed with elevated privileges. The fix dropped privileges to the target process's user, but a race condition between reading the process's identity and executing its binary allowed the bypass to still reach root.

Justin Steven Follow

Published on github.com

History

Justin Steven (@justinsteven), on github.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the service resolved a process's executable path and identity, then executed that path as root without dropping privileges, and the later fix still left a time gap between the identity check and the execution.

Impact

An attacker with any local account could escalate to root on Amazon Linux hosts running the hotpatch, though it gives no initial remote access.

What the attacker needed

Low-privilege local account; hotpatch service installed and running; Amazon Linux host

The fix

The service was fixed in version 1.3-5 to run the target binary with the same privileges as the Java process being patched, and users should update.

How it was found

  1. Obtain low-privilege access to an Amazon Linux host with the hotpatch service installed and running
  2. Create and run a malicious binary named java so the service picks it up
  3. Race the service between its identity check and its execution of the binary
  4. Have the binary run as root and confirm the escalated privileges

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A background service on the machine looks for programs called java and runs them to check their version. It did this as the all-powerful root user, so anyone who could get a program with that name running could have it run as root too. The patch tried to run it as the normal user instead, but the service checked who owned the process and then ran the file a moment later, so an attacker could swap things in between.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More by Justin Steven

View all

4 more disclosed reports, best first.

More from Amazon

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.