Skip to content
SSRF Write-up Advanced

How I Chained 4 vulnerabilities on GitHub Enterprise, From SSRF Execution Chain to RCE!

A webhook feature on GitHub Enterprise could be tricked into requesting internal services, and that first SSRF was chained through a second SSRF in the internal Graphite service, a CR-LF injection in Python's HTTP client, and unsafe Ruby Marshal deserialisation of Memcached data to achieve remote code execution. An attacker with the ability to create a webhook could run commands on the appliance.

Orange Tsai Follow

Published on blog.orange.tw

Bounty$12,500 View original

In the past few months, I spent lots of time preparing for the talk of Black Hat USA 2017 and DEF CON 25. Being a Black Hat and DEFCON speaker is part of my life goal ever.

Orange Tsai (@orange_8361), on blog.orange.tw

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

GitHub Enterprise is the self-hosted edition of GitHub. It runs a set of internal services alongside the main application, and those services are written in a mix of languages: C, C++, Go, Python and Ruby. The feature at the centre of this write-up is WebHook. A repository administrator can register a custom HTTP callback that GitHub Enterprise fires when a specific Git command occurs, for example when files are committed. The instance then sends an HTTP request to the payload URL the administrator supplied.

The article is a case study from a Black Hat USA 2017 and DEF CON 25 talk. The techniques are described as old, but the point is how far they can be pushed when they are chained. The chain combines four vulnerabilities into remote code execution on GitHub Enterprise, and the report won the Best Report award in GitHub's third bug bounty anniversary promotion.

Setup

The researcher's starting point was the architecture of GitHub Enterprise itself. The intuition was that an appliance of this kind contains many internal services, and that being able to talk to those services would make it possible to find something interesting. The work therefore focused on finding Server Side Request Forgery (SSRF) rather than on a single component.

No accounts, roles or tool versions are described in the report beyond the feature itself: a WebHook with a payload URL, triggered by committing files. The internal services that matter later are Elasticsearch on port 9200 and Graphite on port 8000.

Finding it

The WebHook feature and its filter

A WebHook can be created from a URL and triggered by committing files, at which point GitHub Enterprise notifies the configured endpoint with an HTTP request. The payload URL and the callback request are shown in the report as follows:

Payload URL:

Callback Request:

GitHub Enterprise fetches external resources with the Ruby gem faraday, and it tries to stop users from reaching internal services with the gem faraday-restrict-ip-addresses. That gem is described as being just a blacklist, and a blacklist of this kind can be bypassed with the rare IP address formats defined in RFC 3986. On Linux, the value 0 represents localhost.

PoC:

This yields an SSRF, but on its own it is close to useless. The report lists the limitations:

  • Only the POST method
  • Only the HTTP and HTTPS schemes are allowed
  • No 302 redirection
  • No CR-LF injection in faraday
  • The POST data and HTTP headers cannot be controlled

The only part of the request under the attacker's control is the path.

A denial of service aside

Even with those limits, the first SSRF is worth mentioning because it can cause a denial of service. An Elasticsearch service is bound on port 9200, and its shutdown command does not care what the POST data is, so its REST-ful API can be played with. The report gives a denial of service PoC:

Looking for an internal service to pivot through

With a constrained SSRF in hand, the next question was whether any intranet service could be leveraged. Finding one was a large job: several HTTP services run inside the appliance, each built on a different language implementation. After a couple of days of digging, the researcher found Graphite on port 8000. Graphite is a highly scalable real-time graphing system, and GitHub uses it to show statistics to users. It is written in Python and is open source, so its source code could be read directly.

Exploitation

Step 1: the first SSRF in WebHook

The first vulnerability is the blacklist bypass in faraday-restrict-ip-addresses described above. Using a rare IP address format, the WebHook fetch can be pointed at a local address, giving a POST-only SSRF whose path is the only controllable element.

Step 2: the second SSRF in Graphite

Reading the Graphite source quickly revealed another SSRF. In the file webapps/graphite/composer/views.py, Graphite takes a user-supplied url and simply fetches it. That means the first SSRF can be used to trigger the second one, and the two together form an SSRF execution chain.

The SSRF execution chain payload:

The request of the second SSRF:

This turns the POST-based SSRF into a GET-based SSRF. At this stage the chain still cannot do much, so the next stage is needed.

Step 3: CR-LF injection in Python

Graphite fetches resources with Python's httplib.HTTPConnection. Through trial and error, the researcher found a CR-LF injection in httplib.HTTPConnection, which makes it possible to embed malicious payloads in the HTTP protocol itself.

CR-LF injection PoC:

This is described as one small step that becomes a giant leap for the whole chain, because it allows other protocols to be smuggled through the SSRF execution chain. For example, to talk to Redis, the following payload can be tried:

The report notes that SLAVEOF is a very nice command for making out-bound traffic, which is a useful trick when facing a blind SSRF.

Protocol smuggling has its own limitations:

  1. Protocols with handshakes, such as SSH, MySQL and SSL, will fail.
  2. The payload used in the second SSRF only allows bytes from 0x00 to 0x8F, because of Python 2.

The slides show how features in Linux glibc can be used to smuggle protocols over SSL SNI, and include a case study on bypassing Python CVE-2016-5699.

Step 4: unsafe deserialisation in Memcached

With protocol smuggling available, the remaining question was which protocol to smuggle. A lot of time went into working out what could be triggered by controlling Redis or Memcached. While reviewing the source, the researcher became curious about why GitHub stores Ruby objects in Memcached. Digging further showed that GitHub Enterprise uses the Ruby gem memcached to handle caches, and that the cache is wrapped by Marshal. Marshal is dangerous, and the report points readers to the Marshalling Pickles slides by @frohoff and @gebl from AppSec California 2015 for background.

The goal then became clear: use the SSRF execution chain to store malicious Ruby objects in Memcached. The next time GitHub fetches the cache, the Ruby gem memcached de-serializes the data automatically, and the result is remote code execution.

Unsafe Marshal in Rails Console:

The chain in summary

The steps are:

  1. First SSRF: bypass the existing protection in Webhook.
  2. Second SSRF: the SSRF in the Graphite service.
  3. Chain the first SSRF and the second SSRF into an SSRF execution chain.
  4. CR-LF injection in the SSRF execution chain.
  5. Smuggle as the Memcached protocol and insert a malicious Marshal object.
  6. Trigger RCE.

Exploit in a Nutshell:

From the original on blog.orange.tw

The final exploit is published as a Gist, and a video is available on YouTube.

Or watch on YouTube
From the original on blog.orange.tw

Root cause

The chain works because each layer trusts the layer beneath it a little too much. The faraday-restrict-ip-addresses gem is a blacklist rather than an allowlist, so alternative representations of a local address, such as the RFC 3986 rare IP address formats, slip past it. Graphite's composer/views.py fetches a user-supplied url without adequate restriction, which turns a constrained POST-only SSRF into a GET-based one. Python's httplib.HTTPConnection has a CR-LF injection, so the attacker can embed malicious payloads in the HTTP protocol. Finally, the Ruby gem memcached wraps cached values in Marshal and de-serializes them automatically, so anything that can write to the cache can plant an object that executes code when it is read back.

Each individual weakness is limited on its own. The first SSRF cannot change method, scheme, headers or body. The CR-LF injection only matters if there is a protocol worth smuggling. The Marshal deserialisation only matters if the attacker can write to Memcached. Chained together, the limitations of one layer are covered by the next.

Impact

Under the conditions described, a repository administrator who can create a WebHook and trigger it by committing files can reach internal services on the GitHub Enterprise instance. The first SSRF alone is enough to cause a denial of service against the Elasticsearch service on port 9200 through its shutdown command. The full chain ends in remote code execution on the appliance, because the malicious Marshal object is de-serialised by the memcached gem the next time GitHub fetches the cache.

Fix

GitHub made a number of improvements to prevent related issues:

  1. Enhanced the gem faraday-restrict-ip-addresses.
  2. Applied a custom Django middleware to ensure attackers cannot reach a path outside http://[redacted]:8000/render/.
  3. Enhanced iptables rules that block access with the pattern User-Agent: GitHub-Hookshot.

Timeline

  • 2017/01/23 23:22: the vulnerability is reported to GitHub via HackerOne, report number 200542 assigned.
  • 2017/01/23 23:37: GitHub changes the status to Triaged.
  • 2017/01/24 04:43: GitHub responds that the issue is validated and a fix is being worked on.
  • 2017/01/31 14:01: GitHub Enterprise 2.8.7 is released.
  • 2017/02/01 01:02: GitHub responds that the issue has been fixed.
  • 2017/02/01 01:02: GitHub rewards a $7,500 USD bounty.
  • 2017/03/15 02:38: GitHub rewards $5,000 USD for the best report bonus.

Variants to test

  • Rare IP address formats against SSRF filters. Try the RFC 3986 alternative representations of a local address, including 0 for localhost on Linux, wherever a blacklist-based filter guards an outbound fetch. A positive result is a request that reaches a service bound to the loopback interface.
  • Internal graphing or metrics services. Look for Graphite or similar services on their usual ports and read their source for endpoints that fetch a user-supplied url. A positive result is a second fetch that can be triggered through the first SSRF, ideally one that changes the HTTP method.
  • CR-LF in HTTP client libraries. Where a service builds an outbound request from user input, try injecting CR-LF to append a second request or a different protocol. A positive result is a smuggled command reaching a backend such as Redis or Memcached.
  • Cache layers that deserialise. Check whether the application stores serialised objects, such as Ruby Marshal or PHP serialise, in a cache that the attacker can write to through a smuggled protocol. A positive result is code execution when the application reads the poisoned key back.
  • Blind SSRF with outbound commands. When responses are not visible, try commands such as Redis SLAVEOF that cause the target to make an outbound connection to a host you control. A positive result is an inbound connection from the target.
  • Byte-range limits in the smuggling layer. If the payload passes through Python 2, remember that only bytes from 0x00 to 0x8F survive, and design the smuggled protocol payload within that range.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

GitHub Enterprise is a version of GitHub that a company installs on its own servers, inside its own network, instead of using github.com. It is a big piece of software that runs many small helper programs behind the scenes. Those helpers are written in a mix of programming languages: C, C++, Go, Python and Ruby. Each helper does one job, and they talk to each other over the network.

The feature at the centre of this story is called a WebHook. A webhook is a way of telling a service: "when something happens, send a message to this address". In GitHub Enterprise, a repository administrator can register a webhook with a payload URL, and when a specific Git command happens, for example when someone commits files, the instance sends an HTTP request to that URL. Think of it like a doorbell: you wire it to a phone number, and when someone presses the button, your phone rings. Here, the "button" is a commit, and the "phone" is whatever address the administrator typed in.

The researcher's idea was simple. If GitHub Enterprise will happily send a request to any address the administrator gives it, what happens if that address points at one of the internal helper services instead of the open internet? Those internal services are not supposed to be reachable from outside. If you can make the server itself send a request to them, you are effectively standing inside the building.

This kind of trick has a name: Server Side Request Forgery, or SSRF. The word "forgery" is the key. You are not sending the request yourself; you are tricking the server into sending it on your behalf. A useful comparison: imagine a hotel concierge who will fetch anything you ask for from anywhere in the building. Normally that is a service. But if you can ask the concierge to fetch the master key from the security office, the concierge has become your accomplice.

The article is a case study from a talk given at Black Hat USA 2017 and DEF CON 25, two well-known security conferences. The techniques used are described as old, but the point is how far they can be pushed when they are chained together. The chain combines four separate vulnerabilities into remote code execution on GitHub Enterprise. Remote code execution, usually shortened to RCE, means an attacker can make the server run their own code, which is about as bad as it gets. The report won the Best Report award in GitHub's third bug bounty anniversary promotion. A bug bounty is a programme where a company pays people for finding and reporting security problems.

Setup

The starting point was the architecture of GitHub Enterprise itself. The intuition was that an appliance of this kind contains many internal services, and that being able to talk to those services would make it possible to find something interesting. So the work focused on finding SSRF rather than on a single component.

No accounts, roles or tool versions are described beyond the feature itself: a WebHook with a payload URL, triggered by committing files. Two internal services matter later: Elasticsearch on port 9200 and Graphite on port 8000.

A port is a numbered door on a computer. One machine can run many services at once, and each one listens on its own port number, the way one building can have many numbered doors. Elasticsearch is a search and analytics engine. Graphite is a graphing system that draws charts from numbers over time.

Finding it

The WebHook feature and its filter

A WebHook can be created from a URL and triggered by committing files, at which point GitHub Enterprise notifies the configured endpoint with an HTTP request. The payload URL and the callback request are shown in the report as follows:

Payload URL:

Callback Request:

GitHub Enterprise fetches external resources with the Ruby gem faraday, and it tries to stop users from reaching internal services with the gem faraday-restrict-ip-addresses. A gem is a reusable package of code in the Ruby programming language, roughly what an app or a library is elsewhere. faraday is a library for making HTTP requests. faraday-restrict-ip-addresses is a guard that is supposed to stop those requests from going to internal addresses.

That guard is described as being just a blacklist. A blacklist is a list of things you are not allowed to do. The problem with a blacklist is that it only blocks what someone thought of. If there is another way to write the same thing, the blacklist misses it. A comparison: a bouncer with a list of banned faces will let in anyone wearing a disguise.

The disguise here is the rare IP address formats defined in RFC 3986. An IP address is the number that identifies a computer on a network, like a postal address. RFC 3986 is a document that defines how web addresses (URLs) are written, and it allows several different ways to write the same address. On Linux, the value 0 represents localhost. localhost is the standard name a computer uses for itself. So 0 is a shorthand that means "this machine", and the blacklist did not recognise it as such.

PoC:

PoC stands for proof of concept: a small demonstration that the problem is real.

This yields an SSRF, but on its own it is close to useless. The report lists the limitations:

  • Only the POST method
  • Only the HTTP and HTTPS schemes are allowed
  • No 302 redirection
  • No CR-LF injection in faraday
  • The POST data and HTTP headers cannot be controlled

The only part of the request under the attacker's control is the path.

Let us unpack those limitations, because each one matters later.

HTTP is the language browsers and servers use to talk. Every request has a method, which is the verb: GET means "give me this", POST means "here is some data, do something with it". A scheme is the first part of a URL, the http:// or https:// bit. A 302 is a redirect: the server says "the thing you want is over there" and the client follows. CR-LF means carriage return and line feed, the two invisible characters that mark the end of a line in HTTP. Injecting them means sneaking an extra line into a request, which is how you can append a second request or a different protocol. Headers are the extra labelled lines in a request, things like User-Agent or Content-Type. The path is the part of the URL after the hostname, like /some/page.

So the attacker could only choose the path, and nothing else. That is a very narrow opening.

A denial of service aside

Even with those limits, the first SSRF is worth mentioning because it can cause a denial of service. A denial of service, or DoS, means making a service unavailable to its legitimate users, for example by crashing it or shutting it down. An Elasticsearch service is bound on port 9200, and its shutdown command does not care what the POST data is, so its REST-ful API can be played with. The report gives a denial of service PoC:

An API is a defined set of commands one program offers to another. A REST-ful API is one that uses web addresses and HTTP methods as its commands. Elasticsearch's shutdown command is exactly what it sounds like: it tells the service to stop. Because it ignores the POST body, the attacker did not need to control the body to trigger it. They only needed to reach the right path.

Looking for an internal service to pivot through

With a constrained SSRF in hand, the next question was whether any intranet service could be leveraged. An intranet is the private network inside an organisation, the part not reachable from the public internet. Finding a usable service was a large job: several HTTP services run inside the appliance, each built on a different language implementation. After a couple of days of digging, the researcher found Graphite on port 8000. Graphite is a highly scalable real-time graphing system, and GitHub uses it to show statistics to users. It is written in Python and is open source, so its source code could be read directly.

Open source means the code is published and anyone can read it. That is a gift to a researcher: instead of guessing how a program behaves, you can read exactly what it does.

Exploitation

Step 1: the first SSRF in WebHook

The first vulnerability is the blacklist bypass in faraday-restrict-ip-addresses described above. Using a rare IP address format, the WebHook fetch can be pointed at a local address, giving a POST-only SSRF whose path is the only controllable element.

Why start here? Because the webhook is where a repository administrator can ask the server to make a request. Everything else in the chain depends on getting that first foot in the door.

Step 2: the second SSRF in Graphite

Reading the Graphite source quickly revealed another SSRF. In the file webapps/graphite/composer/views.py, Graphite takes a user-supplied url and simply fetches it. That means the first SSRF can be used to trigger the second one, and the two together form an SSRF execution chain.

An execution chain is a sequence of small steps where each one sets up the next, like a row of dominoes. No single domino does much; the chain is what matters.

The SSRF execution chain payload:

The request of the second SSRF:

This turns the POST-based SSRF into a GET-based SSRF. That sounds like a small change, but it is important. The first SSRF could only send POST requests, and POST is awkward for talking to other services. The second SSRF sends GET requests, which is the normal way to ask a service for something. At this stage the chain still cannot do much, so the next stage is needed.

Step 3: CR-LF injection in Python

Graphite fetches resources with Python's httplib.HTTPConnection. Python is a programming language, and httplib is a standard library for talking HTTP. Through trial and error, the researcher found a CR-LF injection in httplib.HTTPConnection, which makes it possible to embed malicious payloads in the HTTP protocol itself.

Remember that CR-LF are the characters that end a line in HTTP. If you can insert them into a value that the library puts into a request, you can end the line early and start a new one of your own. It is like writing a letter and sneaking an extra paragraph into the envelope after the signature: the recipient reads it as part of the same letter.

CR-LF injection PoC:

This is described as one small step that becomes a giant leap for the whole chain, because it allows other protocols to be smuggled through the SSRF execution chain. A protocol is a set of rules two programs agree on to talk, the way two people agree to speak French. HTTP is one protocol; Redis and Memcached are others. Smuggling means carrying one protocol inside another, the way a letter can carry a smaller sealed letter inside it.

For example, to talk to Redis, the following payload can be tried:

Redis is an in-memory data store, a very fast database that keeps everything in memory. The report notes that SLAVEOF is a very nice command for making out-bound traffic, which is a useful trick when facing a blind SSRF. A blind SSRF is one where you cannot see the response, so you have no direct feedback. SLAVEOF tells a Redis server to become a copy of another Redis server, which means it will connect out to an address you choose. If you control that address, you see the connection arrive, and you have proof the command ran even though you never saw a reply.

Protocol smuggling has its own limitations:

  1. Protocols with handshakes, such as SSH, MySQL and SSL, will fail.
  2. The payload used in the second SSRF only allows bytes from 0x00 to 0x8F, because of Python 2.

A handshake is an opening exchange where both sides agree on terms before the real conversation starts. If a protocol insists on a back-and-forth greeting, you cannot smuggle it through a channel that only lets you send one blob of text. A byte is a unit of data, and 0x00 to 0x8F is a range of byte values written in hexadecimal. Python 2, an older version of Python, only let certain byte values through in this path, so the smuggled payload had to be built within that range.

The slides show how features in Linux glibc can be used to smuggle protocols over SSL SNI, and include a case study on bypassing Python CVE-2016-5699. glibc is the standard C library on Linux. SNI is the part of an encrypted connection where the client says which website it wants. CVE-2016-5699 is a public identifier for a known Python bug; CVE numbers are how security issues are catalogued.

Step 4: unsafe deserialisation in Memcached

With protocol smuggling available, the remaining question was which protocol to smuggle. A lot of time went into working out what could be triggered by controlling Redis or Memcached. Memcached is another in-memory cache, a place where programs keep frequently used data so they do not have to recompute it.

While reviewing the source, the researcher became curious about why GitHub stores Ruby objects in Memcached. An object is a bundle of data and behaviour in a program. Digging further showed that GitHub Enterprise uses the Ruby gem memcached to handle caches, and that the cache is wrapped by Marshal. Marshal is Ruby's built-in way of turning an object into a stream of bytes so it can be stored or sent, and turning it back into an object later. That second half, turning bytes back into an object, is called deserialisation.

Marshal is dangerous, and the report points readers to the Marshalling Pickles slides by @frohoff and @gebl from AppSec California 2015 for background. The danger is this: if an attacker can write the bytes, deserialisation will happily build whatever object those bytes describe, and some objects do things when they are created. A comparison: a recipe is harmless on paper, but if a kitchen will cook any recipe you hand it, and one recipe says "open the back door", you have a problem.

The goal then became clear: use the SSRF execution chain to store malicious Ruby objects in Memcached. The next time GitHub fetches the cache, the Ruby gem memcached de-serializes the data automatically, and the result is remote code execution.

Unsafe Marshal in Rails Console:

Rails is a popular web framework written in Ruby, and its console is an interactive prompt for running Ruby code against an application.

The chain in summary

The steps are:

  1. First SSRF: bypass the existing protection in Webhook.
  2. Second SSRF: the SSRF in the Graphite service.
  3. Chain the first SSRF and the second SSRF into an SSRF execution chain.
  4. CR-LF injection in the SSRF execution chain.
  5. Smuggle as the Memcached protocol and insert a malicious Marshal object.
  6. Trigger RCE.

Exploit in a Nutshell:

From the original on blog.orange.tw

The image shows the whole chain at a glance: the first SSRF and the second SSRF joined into an SSRF execution chain, the CR-LF injection inside that chain, the payload smuggled as the Memcached protocol with a malicious Marshal object inserted, and the RCE that follows.

The final exploit is published as a Gist, and a video is available on YouTube.

Or watch on YouTube
From the original on blog.orange.tw

Root cause

The chain works because each layer trusts the layer beneath it a little too much. The faraday-restrict-ip-addresses gem is a blacklist rather than an allowlist, so alternative representations of a local address, such as the RFC 3986 rare IP address formats, slip past it. An allowlist is the opposite of a blacklist: instead of naming what is forbidden, it names what is permitted, and everything else is refused. Allowlists are harder to bypass because a disguise is simply not on the list.

Graphite's composer/views.py fetches a user-supplied url without adequate restriction, which turns a constrained POST-only SSRF into a GET-based one. Python's httplib.HTTPConnection has a CR-LF injection, so the attacker can embed malicious payloads in the HTTP protocol. Finally, the Ruby gem memcached wraps cached values in Marshal and de-serializes them automatically, so anything that can write to the cache can plant an object that executes code when it is read back.

Each individual weakness is limited on its own. The first SSRF cannot change method, scheme, headers or body. The CR-LF injection only matters if there is a protocol worth smuggling. The Marshal deserialisation only matters if the attacker can write to Memcached. Chained together, the limitations of one layer are covered by the next.

Impact

Under the conditions described, a repository administrator who can create a WebHook and trigger it by committing files can reach internal services on the GitHub Enterprise instance. The first SSRF alone is enough to cause a denial of service against the Elasticsearch service on port 9200 through its shutdown command. The full chain ends in remote code execution on the appliance, because the malicious Marshal object is de-serialised by the memcached gem the next time GitHub fetches the cache.

Fix

GitHub made a number of improvements to prevent related issues:

  1. Enhanced the gem faraday-restrict-ip-addresses.
  2. Applied a custom Django middleware to ensure attackers cannot reach a path outside http://[redacted]:8000/render/.
  3. Enhanced iptables rules that block access with the pattern User-Agent: GitHub-Hookshot.

Django is a web framework written in Python. Middleware is code that sits between an incoming request and the application, so it can inspect or block the request before it is handled. [redacted] is the numeric form of localhost, the machine itself. iptables is the Linux firewall tool that decides which network traffic is allowed in and out. User-Agent is the header a client uses to say what software it is; GitHub-Hookshot is the name GitHub Enterprise's webhook sender uses.

Timeline

  • 2017/01/23 23:22: the vulnerability is reported to GitHub via HackerOne, report number 200542 assigned.
  • 2017/01/23 23:37: GitHub changes the status to Triaged.
  • 2017/01/24 04:43: GitHub responds that the issue is validated and a fix is being worked on.
  • 2017/01/31 14:01: GitHub Enterprise 2.8.7 is released.
  • 2017/02/01 01:02: GitHub responds that the issue has been fixed.
  • 2017/02/01 01:02: GitHub rewards a $7,500 USD bounty.
  • 2017/03/15 02:38: GitHub rewards $5,000 USD for the best report bonus.

HackerOne is a platform where security researchers report bugs to companies. Triaged means the report has been reviewed and accepted as a real issue, and is now in the queue to be fixed.

Variants to test

  • Rare IP address formats against SSRF filters. Try the RFC 3986 alternative representations of a local address, including 0 for localhost on Linux, wherever a blacklist-based filter guards an outbound fetch. A positive result is a request that reaches a service bound to the loopback interface. The loopback interface is the network path a machine uses to talk to itself.
  • Internal graphing or metrics services. Look for Graphite or similar services on their usual ports and read their source for endpoints that fetch a user-supplied url. A positive result is a second fetch that can be triggered through the first SSRF, ideally one that changes the HTTP method.
  • CR-LF in HTTP client libraries. Where a service builds an outbound request from user input, try injecting CR-LF to append a second request or a different protocol. A positive result is a smuggled command reaching a backend such as Redis or Memcached.
  • Cache layers that deserialise. Check whether the application stores serialised objects, such as Ruby Marshal or PHP serialise, in a cache that the attacker can write to through a smuggled protocol. A positive result is code execution when the application reads the poisoned key back.
  • Blind SSRF with outbound commands. When responses are not visible, try commands such as Redis SLAVEOF that cause the target to make an outbound connection to a host you control. A positive result is an inbound connection from the target.
  • Byte-range limits in the smuggling layer. If the payload passes through Python 2, remember that only bytes from 0x00 to 0x8F survive, and design the smuggled protocol payload within that range.

Glossary

  • Allowlist: a list of what is permitted; everything not on it is refused.
  • API: a defined set of commands one program offers to another.
  • Blacklist: a list of what is forbidden; anything not on it is allowed.
  • Blind SSRF: an SSRF where the attacker cannot see the response.
  • Bug bounty: a programme that pays people for finding and reporting security problems.
  • Byte: a unit of data, one of the small numbers a computer stores.
  • CR-LF: carriage return and line feed, the characters that end a line in HTTP.
  • CVE: a public identifier for a known security vulnerability.
  • Denial of service (DoS): making a service unavailable to its legitimate users.
  • Deserialisation: turning a stored stream of bytes back into a live object in a program.
  • Django: a web framework written in Python.
  • Elasticsearch: a search and analytics engine.
  • Execution chain: a sequence of small steps where each one sets up the next.
  • Gem: a reusable package of code in Ruby.
  • GET: the HTTP method that asks for something.
  • glibc: the standard C library on Linux.
  • Graphite: a real-time graphing system that draws charts from numbers over time.
  • Handshake: an opening exchange where two sides agree on terms before the real conversation.
  • Header: an extra labelled line in an HTTP request or response.
  • HackerOne: a platform where researchers report bugs to companies.
  • HTTP: the language browsers and servers use to talk.
  • Intranet: the private network inside an organisation.
  • IP address: the number that identifies a computer on a network.
  • iptables: the Linux firewall tool that decides which network traffic is allowed.
  • localhost: the standard name a computer uses for itself.
  • Marshal: Ruby's built-in way of turning an object into bytes and back.
  • Memcached: an in-memory cache where programs keep frequently used data.
  • Method: the verb of an HTTP request, such as GET or POST.
  • Middleware: code that sits between an incoming request and the application.
  • Object: a bundle of data and behaviour in a program.
  • Open source: code that is published and anyone can read.
  • Path: the part of a URL after the hostname.
  • Payload: the data carried inside a request, or the content of an attack.
  • PoC: proof of concept, a small demonstration that a problem is real.
  • Port: a numbered door on a computer that a service listens on.
  • POST: the HTTP method that sends data for the server to act on.
  • Protocol: a set of rules two programs agree on to talk.
  • Python 2: an older version of the Python programming language.
  • Rails: a popular web framework written in Ruby.
  • RCE (remote code execution): making a server run the attacker's code.
  • Redis: an in-memory data store.
  • REST-ful API: an API that uses web addresses and HTTP methods as its commands.
  • RFC 3986: the document that defines how web addresses are written.
  • Scheme: the first part of a URL, such as http:// or https://.
  • Serialisation: turning an object into a stream of bytes so it can be stored or sent.
  • Smuggling: carrying one protocol inside another.
  • SNI: the part of an encrypted connection where the client says which website it wants.
  • SSRF (Server Side Request Forgery): tricking a server into making a request on the attacker's behalf.
  • Triaged: reviewed and accepted as a real issue, now queued to be fixed.
  • User-Agent: the header a client uses to say what software it is.
  • Webhook: a feature that sends a request to a chosen URL when something happens.
  • 302: an HTTP redirect telling the client the thing it wants is elsewhere.

More by Orange Tsai

View all

5 more disclosed reports, best first.

More from GitHub

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.