“How Companies Need to Widen There Scopes”
A forgotten subdomain running an outdated JavaServer Faces resource endpoint was vulnerable to a known remote code execution flaw. The attacker exploited it to run commands and retrieve cloud credentials from the instance metadata service.
I sometimes come across big companies that only focus on some areas of there company and forget the rest which is a huge issue that I have come across in Bug Bounty programs because companies specifically big ones forget that one domain that they probably forgot about or simply do not care for can create the most…
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
This is a short account of a bug bounty finding on a domain that was not listed in a company's programme scope. The researcher, who goes by amnotacat, argues that large organisations tend to watch only part of their estate and forget the rest, and that a forgotten domain can be the one that causes the most trouble. The target here is a single subdomain of a large company, reachable from the internet and presenting nothing more than a login screen. The report does not name the company or the real domain; it uses company.com and example.com as placeholders.
The weakness found was remote code execution through an old JavaServer Faces resource endpoint, combined with access to cloud instance metadata. The report does not give a CVSS score or a severity rating.
Setup
The work was done from outside, with no account on the target and no credentials. The tools used were:
subfinderfor subdomain enumerationhttpxfor probing and status-code filteringwaybackurlsby tomnomnom, from https://github.com/tomnomnom/waybackurls- the public exploit for CVE-2017-1000486 by pimps, from https://github.com/pimps/CVE-1000486
The researcher notes prior experience with this CVE outside bug bounty work, which is why the endpoint was recognised immediately.
Finding it
Enumeration started with a fairly shallow subdomain sweep, piping subfinder into httpx and keeping only the interesting status codes:
subfinder -d company.com -silent | httpx -probe -status-code -silent | grep -e "200" -e "301" -e "302"
Among the results was a domain, referred to as example.com, that served just a login screen. Nothing about the page itself suggested a problem.
The next step was to pull historical URLs for that host with waybackurls, which the researcher uses routinely as part of the enumeration process:
waybackurls example.com
One of the archived paths stood out: /javax.faces.resource/. That path is the signature of CVE-2017-1000486, a remote code execution flaw in JavaServer Faces, and given the size of the company behind the domain it looked worth pursuing.
Exploitation
Step 1: confirm code execution
The public exploit from the pimps repository was run against the host, with cmd=uname as the command. The response was Linux, confirming that commands were being executed on the server.
Step 2: reach the instance metadata service
With command execution confirmed, the researcher immediately tried to obtain AWS keys. A simple curl command against the instance metadata service succeeded:
The report shows the link as http://[redacted]/, pointing at the IAM security-credentials path of the metadata service. The researcher states that the access keys were fetched, but the report does not reproduce the response body or the key material.
Step 3: stop and report
Once the access keys had been retrieved, testing stopped and the issue was reported straight away.
Root cause
The report does not analyse the server-side cause beyond identifying the exposed /javax.faces.resource/ endpoint as CVE-2017-1000486. That CVE is an expression language injection flaw in JavaServer Faces that allows an attacker to pass a command through the resource endpoint and have it executed by the application server.
The second half of the chain is the metadata service: the instance was able to reach [redacted] and the credentials endpoint answered, so the application's network position allowed access to instance credentials.
Impact
An unauthenticated attacker could run commands on the server and, from there, read the IAM credentials of the instance. In the researcher's words, this is the kind of access that lets someone "drop a shell inside there infrastructure".
The organisational side is the point of the title. The domain was not listed in scope, but it was not explicitly out of scope either. The researcher had previously asked the company how to report an issue on a domain that was not in scope and received a friendly response, which is why the report was submitted rather than dropped. After the remote code execution was reported, the company added the domain to its out-of-scope list. The researcher questions that reaction, arguing that when a company blacklists every domain outside scope it signals that something larger is being protected rather than that hackers are being invited to help secure the estate. The company did pay something for the remote code execution, among other issues the researcher also submitted, which the report notes is not the norm.
Fix
What it records is the programme change: the domain was moved to out of scope after the report. The researcher's own position is that scopes should be widened rather than narrowed, and that domains an organisation does not want tested should be named explicitly instead of the whole out-of-scope space being blacklisted.
Variants to test
- Run the same shallow enumeration against other large programmes and look for hosts that return only a login page; a forgotten host with a single application is exactly the profile described here.
- Pull historical URLs for every host and grep for framework resource paths such as
/javax.faces.resource/. A hit on an old, unmaintained host is a candidate for CVE-2017-1000486. - Where command execution is confirmed, try
unamefirst to establish the platform, then attempt to reachhttp://[redacted]/latest/metadata/iam/security-credentials/. A positive result is the credentials endpoint answering. - Check programme scope pages for domains that are neither listed nor explicitly excluded, and ask the programme in advance how such reports should be submitted. A clear answer is the precondition for testing them at all.
What happened, in plain words
A security researcher who goes by the name amnotacat found a serious problem on a website belonging to a large company. The website was a single subdomain, reachable by anyone on the internet, and it showed nothing more than a login screen. Behind that login screen was an old piece of software with a known flaw that let the researcher run commands on the server. From there, the researcher was able to reach a special internal address that cloud servers use to hand out their own credentials, and read the company's cloud access keys.
The twist is that this domain was not listed in the company's bug bounty scope. A bug bounty programme is an arrangement where a company invites outside people to look for security problems and pays them for good reports. The scope is the list of what is allowed to be tested. This domain was not on the list, but it was not explicitly forbidden either. The researcher had asked the company in advance how to report issues on domains outside the scope and got a friendly answer, so the report was submitted. After the remote code execution was reported, the company added the domain to its out-of-scope list. The researcher questions that reaction and argues that companies should widen their scopes rather than narrow them.
The report does not name the company or the real domain. It uses company.com and example.com as stand-ins.
The concepts you need first
Before walking through the steps, here are the ideas the report relies on, explained from zero.
- Subdomain: a smaller address under a main domain. If
company.comis the main building,login.company.comorshop.company.comare separate doors into the same organisation. Large companies have many of them, and it is easy to forget one. - Enumeration: the process of listing things. Subdomain enumeration means finding out which subdomains exist, usually by trying many possible names and seeing which ones answer.
- HTTP status code: a three-digit number a web server sends back to say how a request went.
200means "here is the page".301and302mean "the page has moved, go here instead". These are the codes that indicate a live, working host. - Wayback Machine: an internet archive that stores old copies of web pages.
waybackurlsis a tool that asks the archive for every URL it has ever recorded for a domain. Old URLs are useful because they reveal pages and paths that may still exist but are no longer linked anywhere. - Endpoint: a specific address on a server that does something, such as a page, an API route or a resource path. Think of it as a particular counter in a large building.
- API: a way for one piece of software to talk to another. A restaurant menu is a common comparison: you do not walk into the kitchen, you order from the menu and the kitchen sends back a dish. An API is the menu and the kitchen window between programs.
- JavaServer Faces (JSF): a framework for building web applications in the Java programming language. It provides ready-made components such as buttons and forms, and it serves some of its own resources through a path that starts with
/javax.faces.resource/. - CVE: a public catalogue number for a known security flaw.
CVE-2017-1000486is the identifier for a specific flaw in JavaServer Faces, published in 2017. When a flaw is public, anyone can read about it and use existing tools against systems that have not been fixed. - Remote code execution (RCE): the most serious kind of web vulnerability. It means an attacker can make the server run commands of their choosing, as if they were sitting at its keyboard. The everyday comparison is getting a stranger to run errands inside your house while you think they are only talking to you at the door.
- Expression language injection: the technical cause of CVE-2017-1000486. Programs sometimes turn data into a compact form to store or send it (serialisation) and turn it back later (deserialisation). If the program turns untrusted data back into objects without checking it, an attacker can smuggle in instructions that the program then carries out.
- Instance metadata service: cloud providers such as AWS run a small internal service on every virtual server. The server can ask it questions about itself, such as "what is my name" or "what credentials am I allowed to use". It lives at the special address
[redacted], which only works from inside the cloud network. The comparison is a staff noticeboard inside an office: only people already inside can read it, but it holds the keys to the building. - IAM: Identity and Access Management, the AWS system that decides which credentials may do what. The path
/latest/metadata/iam/security-credentials/is where the metadata service lists the roles attached to the server and hands out temporary keys for them. - Access keys: the username-and-password equivalent for programs talking to a cloud provider. Anyone holding them can act as the server, within whatever permissions the role allows.
- Scope and out of scope: the rules of a bug bounty programme. In scope means "you may test this and we will consider reports". Out of scope means "do not test this". A domain that is neither listed nor excluded sits in a grey area, which is the heart of this story.
- curl: a command-line tool for fetching a URL. It is the text-only equivalent of typing an address into a browser and pressing Enter.
Step 1: finding the forgotten door
The researcher started with a fairly shallow sweep for subdomains. The command chains three tools together, so the output of one becomes the input of the next:
subfinder -d company.com -silent | httpx -probe -status-code -silent | grep -e "200" -e "301" -e "302"
Line by line:
subfinder -d company.com -silentasks subfinder to find subdomains ofcompany.com. The-silentflag keeps the output clean, showing only the results and not progress chatter.- The vertical bar
|is a pipe. It takes whatever the first command printed and feeds it to the next command as input. httpx -probe -status-code -silenttakes each subdomain and actually tries to connect to it.-probemeans "check whether it is alive", and-status-codemeans "also tell me the HTTP status code it returned".- The second pipe passes those results to
grep, a tool that filters lines by pattern.-e "200" -e "301" -e "302"keeps only lines containing one of those three codes, which are the ones that indicate a working website.
Why this step: the goal is to find live hosts, not to attack anything yet. A shallow sweep is quick and covers a lot of ground. Among the results was a domain, called example.com in the report, that served just a login screen. Nothing on the page itself looked wrong.
Step 2: looking in the archive for old paths
Next, the researcher pulled historical URLs for that host. This is a routine part of the enumeration process:
waybackurls example.com
Line by line:
waybackurlsis the tool by tomnomnom, available at https://github.com/tomnomnom/waybackurls.example.comis the domain to look up.- The tool asks the Wayback Machine for every URL it has recorded for that domain and prints them, one per line.
Why this step: a login screen tells you almost nothing. Old archived URLs, however, can reveal paths that were once public and may still be live, even if nothing links to them today. One of the archived paths stood out immediately: /javax.faces.resource/.
That path is the signature of CVE-2017-1000486, a remote code execution flaw in JavaServer Faces. The researcher had met this flaw before, outside bug bounty work, which is why it was recognised at a glance. Given the size of the company behind the domain, it looked worth pursuing.
Step 3: confirming that commands run
The public exploit from the pimps repository, at https://github.com/pimps/CVE-1000486, was run against the host with cmd=uname as the command. The response was Linux.
Why this step: uname is a standard command that asks the operating system to identify itself. It is harmless and its output is predictable, which makes it a safe way to prove that commands are really being executed on the server rather than merely reflected back. Getting Linux confirmed the flaw was live.
Step 4: asking the server for its own keys
With command execution confirmed, the researcher immediately tried to obtain AWS keys. A simple curl command against the instance metadata service succeeded:
Line by line:
curlfetches the URL that follows.http://[redacted]is the fixed address of the cloud metadata service. It is not a normal internet address; it only answers from inside the cloud network, which is why the researcher had to go through the compromised server to reach it./latest/metadata/iam/security-credentials/is the path that lists the IAM roles attached to the instance and, for a named role, returns temporary credentials for it.
The report shows the link as http://[redacted]/, pointing at the IAM security-credentials path. The researcher states that the access keys were fetched, but the report does not reproduce the response body or the key material.
Why this step: command execution on a server is already serious, but the metadata service is what turns it into cloud access. If the server can reach [redacted] and the credentials endpoint answers, the attacker inherits the server's identity. That is the difference between getting into one room and getting the keys to every room the server is allowed to enter.
Step 5: stop and report
Once the access keys had been retrieved, testing stopped and the issue was reported straight away. Why: the keys were enough to demonstrate the impact.
Why the flaw existed
The report does not analyse the server-side cause beyond identifying the exposed /javax.faces.resource/ endpoint as CVE-2017-1000486. That CVE is an expression language injection flaw in JavaServer Faces that allows an attacker to pass a command through the resource endpoint and have it executed by the application server. The report does not say which JSF version or application stack was in use, nor why the endpoint had not been patched.
The second half of the chain is the metadata service: the instance was able to reach [redacted] and the credentials endpoint answered, so the application's network position allowed access to instance credentials.
What the impact was
An unauthenticated attacker, meaning someone with no account and no password, could run commands on the server and, from there, read the IAM credentials of the instance. In the researcher's words, this is the kind of access that lets someone "drop a shell inside there infrastructure".
The organisational side is the point of the title. The domain was not listed in scope, but it was not explicitly out of scope either. The researcher had previously asked the company how to report an issue on a domain that was not in scope and received a friendly response, which is why the report was submitted rather than dropped. The researcher questions that reaction, arguing that when a company blacklists every domain outside scope it signals that something larger is being protected rather than that hackers are being invited to help secure the estate. The company did pay something for the remote code execution, among other issues the researcher also submitted, which the report notes is not the norm.
What was fixed
What it records is the programme change: the domain was moved to out of scope after the report. The researcher's own position is that scopes should be widened rather than narrowed, and that domains an organisation does not want tested should be named explicitly instead of the whole out-of-scope space being blacklisted.
Things worth trying on other programmes
- Run the same shallow enumeration against other large programmes and look for hosts that return only a login page. A forgotten host with a single application is exactly the profile described here.
- Pull historical URLs for every host and grep for framework resource paths such as
/javax.faces.resource/. A hit on an old, unmaintained host is a candidate for CVE-2017-1000486. - Where command execution is confirmed, try
unamefirst to establish the platform, then attempt to reachhttp://[redacted]/latest/metadata/iam/security-credentials/. A positive result is the credentials endpoint answering. - Check programme scope pages for domains that are neither listed nor explicitly excluded, and ask the programme in advance how such reports should be submitted. A clear answer is the precondition for testing them at all.
Glossary
- Access keys: the credential pair a program uses to act as a cloud identity, equivalent to a username and password.
- API: a defined way for one piece of software to request something from another.
- Bug bounty programme: a scheme where a company invites outside researchers to report security problems, usually with a reward.
- CVE: a public catalogue number for a known security vulnerability.
- CVE-2017-1000486: an expression language injection flaw in JavaServer Faces that allows remote code execution through the resource endpoint.
- curl: a command-line tool for fetching URLs.
- Deserialisation: turning stored or transmitted data back into program objects; unsafe deserialisation of untrusted data can let an attacker inject instructions.
- Endpoint: a specific address on a server that performs an action or returns a resource.
- Enumeration: systematically listing things, such as the subdomains that exist for a domain.
- grep: a command-line tool that filters text by pattern.
- HTTP status code: a three-digit number a server returns to describe the outcome of a request, such as 200 for success or 301 and 302 for redirects.
- httpx: a tool that probes hosts to see whether they are alive and reports details such as status codes.
- IAM: Identity and Access Management, the cloud system that defines what a credential is allowed to do.
- Instance metadata service: an internal cloud service at
[redacted]that answers questions from a server about itself, including handing out credentials. - JavaServer Faces (JSF): a Java framework for building web applications, which serves some resources under
/javax.faces.resource/. - Out of scope: explicitly excluded from testing under a bug bounty programme.
- Pipe: the
|symbol that passes the output of one command as input to the next. - Remote code execution (RCE): a vulnerability that lets an attacker run commands on a server.
- Scope: the list of assets a bug bounty programme allows to be tested.
- subfinder: a tool that discovers subdomains for a domain.
- Subdomain: a smaller address under a main domain, such as
login.company.comundercompany.com. - uname: a standard command that reports which operating system the server runs.
- Wayback Machine: an internet archive of old web pages and URLs.
- waybackurls: a tool that retrieves every URL the Wayback Machine has recorded for a domain.