Skip to content
Misconfiguration Write-up Beginner

Popping the Pornhub Cherry

An internet-exposed memcached service was found on a non-standard port on a staging subdomain. An attacker could connect to it and issue commands, potentially clearing the cache or causing an overflow.

Andy Gill Follow

Published on blog.zsec.uk

Bounty$2,500 View original

Currently at time of writing I'm ranked #1 finder of Bugs on https://hackerone.com/pornhub which is a nice position to hold. This post is to explain the techniques I've used to get to where I am and how I found my most recent $2500 bug on pornhub.

Andy Gill (@ZephrFish), on blog.zsec.uk

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. 6 min read.

Context

Pornhub ran a bug bounty programme on HackerOne with a scope of *.pornhub.com. At the time of writing, Andy Gill (@ZephrFish) was ranked the number one finder of bugs on that programme. This write-up covers the reconnaissance approach he used across the programme and, in detail, the finding that earned him $2,500: an internet-exposed memcached service on a staging host. The finding was later included in Web Hacking 101 by Peter Yaworski.

The report itself gives the following summary details:

Field Value
Difficulty Low
URL stage.pornhub.com
Report link https://hackerone.com/reports/119871
Date reported 1 March 2016
Bounty paid $2,500
Popping the Pornhub Cherry
Popping the Pornhub Cherry From the original on blog.zsec.uk

Setup

No accounts, credentials or special roles were needed. The only precondition was the scope itself, which covered every subdomain of pornhub.com:

Text
*.pornhub.com

For subdomain enumeration the author used three tools, backed by a custom wordlist of over one million unique subdomains that he had built from earlier DNS research (presented in a talk titled All Your Hostnames are Belong to Us):

For visual mapping of the estate he used Eyewitness, feeding it the list of URLs and receiving an HTML report of the URLs that served valid HTTP or HTTPS pages. Port scanning was done with nmap, and the exposed service was probed with netcat.

Finding it

Enumeration produced close to 90 unique hostnames. After mapping them visually, the next step was looking for interesting open ports on selected subdomains. One host stood out:

Text
stage.pornhub.com

Because an IP address is easier to scan than a domain name, the first step was to resolve it:

Text
nslookup stage.pornhub.com
Server:         [redacted]
Address:        [redacted]#53

Non-authoritative answer:
Name:   stage.pornhub.com
Address: [redacted]

With the IP in hand, a full TCP port scan with service and version detection was launched in the background:

Bash
nmap -sSV -p- [redacted] -oA stage_ph -T4 &

The scan returned three open ports out of 65,535:

Text
 Starting Nmap 6.47 ( http://nmap.org )
 Nmap scan report for [redacted]
 Host is up (0.017s latency).
 Not shown: 65532 closed ports
 PORT    STATE    SERVICE      VERSION
 80/tcp  open     http         nginx
 443/tcp open     http         nginx
 60893/tcp open   memcache

 Service detection performed. Please report any incorrect results at  http://nmap.org/submit/ .
 Nmap done: 1 IP address [redacted] scanned in 22.73 seconds

Ports 80 and 443 running nginx are unremarkable. Port 60893 identified as memcache is not: memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) returned from database calls, API calls or page rendering. It is a caching backend, not something that should be reachable from the internet, and it was listening on a non-standard port. That mismatch between what the service is and where it was exposed is what made it worth probing.

Exploitation

Step 1: Connect and check the version

The service was reachable with netcat, so the first probe was a simple version request:

Bash
nc [redacted] 60893 -v
version
VERSION 2.1.1r-49-gbe05158
stats
STAT pid 8141
--SNIP--
STAT evictions 0
END

The version command returned the memcached build string, and stats returned server statistics including the process ID and eviction count. Neither command is malicious; the point was to confirm that the service was accepting and answering commands from an unauthenticated remote client. It was.

Step 2: Assess what else the service allows

With command execution confirmed, further reading of the memcached wiki showed that other, more damaging commands are available to any client that can connect, including commands that clear the system or cause an overflow. The author did not run these against the target; the exposure of a command-accepting cache was itself the finding, and it was reported at that point.

Step 3: Report and follow the timeline

The issue was reported on HackerOne and handled as follows:

  1. Reported on HackerOne to Pornhub: 1 March 2016
  2. Pornhub verifies it is an issue: 1 March 2016
  3. Pornhub triages the bug: 1 March 2016
  4. Pornhub awards a $75 bounty: 8 March 2016
  5. Report disclosed publicly: 26 May 2016
  6. Pornhub re-awards the vulnerability with a $2,425 bounty: 29 May 2016

The Pornhub Network issued this statement on the re-award:

We have modified the payout table to better align with the other public bounty programs. We want to be fair with every researchers, and as such we are retroactively crediting all past submissions according to the new payout table.

The report describes $2,500 as a decent bounty as it was originally, with the $2,425 increase on top of the $75 always appreciated.

Root cause

The mistake was one of exposure rather than application logic. A memcached instance was reachable from the internet on port 60893, a non-standard port. The service answered commands from an unauthenticated remote client, so anyone who could connect could issue them. The report does not describe any firewall or network ACL that was meant to protect the service.

Impact

Because the service answered commands from an unauthenticated remote client, an attacker who found the port could read cache statistics and version information, and, per the memcached documentation the author consulted, could run more destructive commands such as clearing the cache or triggering an overflow. Memcached is described as holding the results of database calls, API calls and page rendering, but the report does not say what data was cached or whether it was read. The author reported the exposure as soon as command responses were confirmed and did not attempt the destructive commands. The report does not quantify what data was cached or how many users were affected.

Fix

The issue has been fixed: Pornhub closed the port and removed the service. More generally, a cache like this should never be reachable from the internet; it belongs on an internal network segment, restricted by firewall rules to the application hosts that need it, and ideally bound to a loopback or private interface rather than a public one.

Variants to test

  • Full-port scans on every in-scope host. The memcached instance was only found because the scan covered all 65,535 TCP ports. A positive result is any port outside the usual 80/443 range answering with a recognisable service banner.
  • Service fingerprinting on unusual ports. nmap's version detection labelled 60893 as memcache. A positive result is a service identification that does not match the host's expected role, especially a backend datastore or cache.
  • Direct protocol probes with netcat. Sending version and stats to a suspected memcached port confirms whether it accepts unauthenticated commands. A positive result is a VERSION line and a STAT block coming back.
  • Staging and non-production hostnames. The affected host was stage.pornhub.com, a name that suggests a pre-production environment where hardening is often weaker. A positive result is a staging host exposing the same services as production but with fewer controls.
  • Custom subdomain wordlists. The author attributes much of the coverage to a list of over one million subdomains. A positive result is additional hostnames that the default tool lists miss.

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. 13 min read.

What happened, in plain words

Pornhub, the adult website, ran a programme where security researchers could look for mistakes in its systems and get paid for reporting them. This is called a bug bounty programme, and it was hosted on a website called HackerOne. Companies publish a set of rules, called a scope, that says which of their systems you are allowed to test. In this case the scope was every subdomain of pornhub.com.

A subdomain is a name that sits in front of the main domain, like shop.example.com or mail.example.com. Big companies own many of them, and each one is a separate website or service. The researcher, Andy Gill (known online as @ZephrFish), was at the time the number one finder of bugs on that programme. This article explains the approach he used and, step by step, the single finding that earned him $2,500.

The finding was a caching service called memcached that was reachable from the open internet on a staging server. A staging server is a copy of a website used for testing before changes go live, a bit like a rehearsal stage before the real performance. The service was answering commands from anyone who could connect to it, with no password at all. That is the whole bug: something that should have been locked inside the company was instead standing in the street with the door open.

The report gives these summary details:

Field Value
Difficulty Low
URL stage.pornhub.com
Report link https://hackerone.com/reports/119871
Date reported 1 March 2016
Bounty paid $2,500
Popping the Pornhub Cherry
Popping the Pornhub Cherry From the original on blog.zsec.uk

Setup

No accounts, passwords or special permissions were needed to do any of this. The only precondition was the scope, which covered every subdomain of pornhub.com:

Text
*.pornhub.com

The asterisk is a wildcard. It means "anything", so *.pornhub.com covers stage.pornhub.com, blog.pornhub.com, and every other name ending in .pornhub.com. For a researcher this is a large playground: the more names in scope, the more chances that one of them has been set up carelessly.

To find those names, the researcher used three tools that hunt for subdomains, backed by a custom list of over one million unique subdomains that he had built from earlier research of his own. That research was presented in a talk titled All Your Hostnames are Belong to Us.

These tools work a bit like trying every key on a keyring against a door: they take a long list of common names (dev, test, stage, mail, and so on) and check which ones actually exist under the company's domain. A custom list of over a million names is simply a much bigger keyring than the default one that ships with the tools.

For the next step, visually mapping the estate, he used Eyewitness. He fed it the list of URLs and it produced an HTML report of the URLs that served valid HTTP or HTTPS pages. In plain terms, Eyewitness produces an HTML report of the URLs that serve valid HTTP or HTTPS pages, so you can review the estate without visiting each one by hand. HTTP and HTTPS are the two protocols browsers use to fetch web pages; HTTPS is the encrypted version.

Port scanning was done with nmap, and the exposed service was probed with netcat. Both are explained where they first appear below.

Finding it

The subdomain enumeration produced close to 90 unique hostnames. After mapping them visually, the next step was looking for interesting open ports on selected subdomains. A port is a numbered doorway on a computer. One machine can run many services at once, and each service listens on its own doorway: web pages usually on 80 (HTTP) or 443 (HTTPS), email on other numbers, and so on. Scanning ports means knocking on every doorway to see which ones answer and what is behind them.

One host stood out:

Text
stage.pornhub.com

The name stage suggests a pre-production environment, the place where changes are tested before they reach the real site.

Because an IP address is easier to scan than a domain name, the first step was to resolve it. An IP address is the numeric address of a machine on the internet, like a street address, while a domain name is the friendly label humans use. A DNS lookup is the phone book that translates one into the other.

Text
nslookup stage.pornhub.com
Server:         [redacted]
Address:        [redacted]#53

Non-authoritative answer:
Name:   stage.pornhub.com
Address: [redacted]

Line by line:

  • nslookup stage.pornhub.com asks the DNS system, the internet's phone book, what numeric address belongs to that name.
  • Server: [redacted] and Address: [redacted]#53 say which phone book was asked. [redacted] is a well-known public DNS resolver, and 53 is the standard port for DNS questions.
  • It is still the answer the internet will use.
  • Name and Address give the result: the domain name and the numeric IP address it points to.

With the IP in hand, a full TCP port scan with service and version detection was launched in the background:

Bash
nmap -sSV -p- [redacted] -oA stage_ph -T4 &

What each part does:

  • nmap is the port scanner, a tool that knocks on doorways and reports which ones open.
  • -sSV asks nmap not just which ports are open but also which service and version is behind each one. The capital V is the version detection part.
  • -p- means scan all 65,535 TCP ports, not just the common ones. This matters later: the interesting service was on a very unusual port number that a quick default scan would likely have missed.
  • The IP address is the target.
  • -oA stage_ph saves the output in several formats under the name stage_ph, so the results can be reviewed later.
  • -T4 is a speed setting, faster than the default but not the most aggressive.
  • The trailing & runs the scan in the background so the terminal stays usable while it works.

The scan returned three open ports out of 65,535:

Text
 Starting Nmap 6.47 ( http://nmap.org )
 Nmap scan report for [redacted]
 Host is up (0.017s latency).
 Not shown: 65532 closed ports
 PORT    STATE    SERVICE      VERSION
 80/tcp  open     http         nginx
 443/tcp open     http         nginx
 60893/tcp open   memcache

 Service detection performed. Please report any incorrect results at  http://nmap.org/submit/ .
 Nmap done: 1 IP address [redacted] scanned in 22.73 seconds

Reading the output:

  • Host is up (0.017s latency) means the machine answered and is reachable; the latency is how long a reply took.
  • Not shown: 65532 closed ports means 65,532 of the 65,535 doorways were shut. Only three were open.
  • 80/tcp open http nginx and 443/tcp open http nginx are the normal web doorways, serving pages through a web server called nginx. Nothing surprising there.
  • 60893/tcp open memcache is the odd one. A service called memcache is listening on port 60893, a number far outside the usual range.

Ports 80 and 443 running nginx are unremarkable. Port 60893 identified as memcache is not. Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) returned from database calls, API calls or page rendering. Unpacking that: a database is where a website keeps its permanent data; an API is the way one piece of software asks another for data, like a waiter taking your order to the kitchen; and page rendering is the work of building the page a visitor sees. All three are slow compared with reading from memory, so a cache keeps recent answers in fast memory and hands them out again instead of asking the database every time. It is a caching backend, a helper that sits behind the website, not something that should be reachable from the internet. And it was listening on a non-standard port. That mismatch between what the service is and where it was exposed is what made it worth probing.

Exploitation

Step 1: Connect and check the version

The service was reachable with netcat, so the first probe was a simple version request. Netcat is a small tool that opens a raw connection to a port and lets you type text straight at whatever is listening, like picking up a phone and talking directly to the machine instead of going through a website.

Bash
nc [redacted] 60893 -v
version
VERSION 2.1.1r-49-gbe05158
stats
STAT pid 8141
--SNIP--
STAT evictions 0
END

Line by line:

  • nc [redacted] 60893 -v opens a connection to the target machine on port 60893. The -v makes netcat report connection details.
  • version is a command typed into that connection. It asks the service which version of itself it is running.
  • VERSION 2.1.1r-49-gbe05158 is the service's answer: a build string identifying the software.
  • stats is another command, asking for server statistics.
  • STAT pid 8141 is one of the statistics returned: the process ID, the number the operating system uses to track the running program.
  • --SNIP-- marks lines left out of the article.
  • STAT evictions 0 is another statistic, the eviction count: how many stored items have been thrown away to make room. Zero here.
  • END marks the end of the statistics reply.

Neither command is malicious. The point was to confirm that the service was accepting and answering commands from an unauthenticated remote client, meaning a stranger on the internet with no password. It was. That single fact is the bug: a backend cache should never be having a conversation with a random person on the internet.

Step 2: Assess what else the service allows

With command execution confirmed, further reading of the memcached wiki showed that other, more damaging commands are available to any client that can connect, including commands that clear the system or cause an overflow. An overflow, in simple terms, is feeding a program more data than it was built to hold, which can make it misbehave or crash.

The author did not run these against the target. The exposure of a command-accepting cache was itself the finding, and it was reported at that point. This is an important habit in bounty work: prove the problem exists, then stop, rather than causing damage to show off.

Step 3: Report and follow the timeline

The issue was reported on HackerOne and handled as follows:

  1. Reported on HackerOne to Pornhub: 1 March 2016
  2. Pornhub verifies it is an issue: 1 March 2016
  3. Pornhub triages the bug: 1 March 2016
  4. Pornhub awards a $75 bounty: 8 March 2016
  5. Report disclosed publicly: 26 May 2016
  6. Pornhub re-awards the vulnerability with a $2,425 bounty: 29 May 2016

Triaging means the company sorts and confirms the report, deciding how serious it is and who should fix it. Disclosed publicly means the report was made visible to everyone, not just the company and the researcher.

The Pornhub Network issued this statement on the re-award:

We have modified the payout table to better align with the other public bounty programs. We want to be fair with every researchers, and as such we are retroactively crediting all past submissions according to the new payout table.

In other words, the company changed how much it pays for different kinds of bugs and then went back and topped up earlier reports to match the new amounts. The report describes $2,500 as a decent bounty as it was originally, with the $2,425 increase on top of the $75 always appreciated.

Root cause

The mistake was one of exposure rather than application logic. Nothing was wrong with the website's code; the problem was where a piece of infrastructure had been placed. A memcached instance was reachable from the internet on port 60893, a non-standard port. The service answered commands from an unauthenticated remote client, so anyone who could connect could issue them. The report does not describe any firewall or network ACL that was meant to protect the service. A firewall is a filter that decides which connections are allowed in or out; an ACL, or access control list, is the written rule set behind that filter.

Impact

Because the service answered commands from an unauthenticated remote client, an attacker who found the port could read cache statistics and version information, and, per the memcached documentation the author consulted, could run more destructive commands such as clearing the cache or triggering an overflow. Memcached is described as holding the results of database calls, API calls and page rendering, but the report does not say what data was cached or whether it was read. Think of it as a shared noticeboard in an office that someone has wheeled out onto the pavement: anyone walking past can read what is pinned there.

The author reported the exposure as soon as command responses were confirmed and did not attempt the destructive commands. The report does not quantify what data was cached or how many users were affected.

Fix

The issue has been fixed: Pornhub closed the port and removed the service. More generally, a cache like this should never be reachable from the internet. It belongs on an internal network segment, restricted by firewall rules to the application hosts that need it, and ideally bound to a loopback or private interface rather than a public one. A loopback interface is the machine talking to itself, reachable only from that same machine.

Variants to test

If you want to look for the same kind of mistake on a programme you are allowed to test, these are the angles the write-up points to:

  • Full-port scans on every in-scope host. The memcached instance was only found because the scan covered all 65,535 TCP ports. A positive result is any port outside the usual 80/443 range answering with a recognisable service banner.
  • Service fingerprinting on unusual ports. nmap's version detection labelled 60893 as memcache. A positive result is a service identification that does not match the host's expected role, especially a backend datastore or cache.
  • Direct protocol probes with netcat. Sending version and stats to a suspected memcached port confirms whether it accepts unauthenticated commands. A positive result is a VERSION line and a STAT block coming back.
  • Staging and non-production hostnames. The affected host was stage.pornhub.com, a name that suggests a pre-production environment where hardening is often weaker. A positive result is a staging host exposing the same services as production but with fewer controls.
  • Custom subdomain wordlists. The author attributes much of the coverage to a list of over one million subdomains. A positive result is additional hostnames that the default tool lists miss.

Glossary

  • Bug bounty programme: A scheme where a company pays researchers for reporting security mistakes in its systems.
  • Scope: The set of systems a company allows researchers to test, and the rules for doing so.
  • Subdomain: A name in front of a main domain, such as stage in stage.pornhub.com, usually pointing to a separate service.
  • Wildcard: The * symbol, meaning "anything", so *.pornhub.com covers every subdomain.
  • Subdomain enumeration: Finding which subdomains exist under a domain, usually by trying a long list of common names.
  • Wordlist: A list of names or words a tool tries one by one.
  • HTTP / HTTPS: The protocols browsers use to fetch web pages; HTTPS is the encrypted version.
  • Port: A numbered doorway on a computer through which a particular service listens.
  • Port scan: Knocking on many doorways to see which are open and what answers.
  • IP address: The numeric address of a machine on the internet.
  • DNS: The internet's phone book, translating domain names into IP addresses.
  • DNS resolver: A server that answers DNS questions, such as 8.8.8.8.
  • nmap: A tool that scans ports and identifies the services and versions behind them.
  • netcat: A tool that opens a raw connection to a port and lets you type text directly at the service.
  • nginx: A common web server program that serves web pages.
  • Memcached: An in-memory key-value store used to cache the results of database calls, API calls and page rendering.
  • Cache: A fast store of recent answers, kept so the same work does not have to be done twice.
  • Database: Where a website keeps its permanent data.
  • API: The way one piece of software asks another for data or asks it to do something.
  • Page rendering: The work of building the page a visitor sees.
  • Backend: A service that sits behind a website, not meant to be reached directly by the public.
  • Unauthenticated: Allowed without any password or identity check.
  • Command: A short instruction typed at a service, such as version or stats.
  • Overflow: Feeding a program more data than it was built to hold, which can make it misbehave or crash.
  • Triage: The company sorting and confirming a report and deciding how serious it is.
  • Disclosure: Making a report visible to the public.
  • Firewall: A filter that decides which network connections are allowed in or out.
  • ACL (access control list): The written rule set a firewall or system uses to allow or deny access.
  • Loopback interface: The machine talking to itself, reachable only from that same machine.
  • Staging environment: A copy of a site used for testing before changes go live.
  • Eyewitness: A tool that opens a list of URLs and produces a visual report of the pages that respond.

More by Andy Gill

View all

4 more disclosed reports, best first.

More from PornHub

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.