A Test Secret in Production: How a Rails Session Cookie Earned $18,000 from GitHub
The GitHub Enterprise management console signed Rails session cookies with a static, hard-coded secret intended for development, and deserialised session data with Marshal.load. An attacker who knew the secret could forge a signed cookie containing malicious serialised objects, leading to remote code execution.
GitHub Enterprise is the version of GitHub that companies run on their own servers. Alongside the main application, it has a management console, the web interface that administrators use to configure and operate the appliance.
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 a file permission change prevented the randomly generated session secret from loading, so the system silently fell back to a hard-coded development secret, and the session data was then deserialised with Marshal.load.
Impact
An attacker could forge a session cookie and achieve remote code execution on the management console, potentially taking control of the server hosting a company's source code.
What the attacker needed
Knowledge of the static secret; access to the management console
The fix
The patched release defaults to a randomly generated session secret when the configured one is missing, and newer releases use a 16-byte random secret.
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 session cookie is how a website remembers you are logged in. This console put your session data inside the cookie and signed it with a secret key so nobody could tamper with it. But the key was a fixed value that anyone could know, and the server turned the cookie data back into program objects in a way that can run code. So an attacker could make a fake cookie that the server trusted and use it to run commands on the machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.