How I Hacked Facebook, and Found Someone's Backdoor Script
The author found a pre-authentication SQL injection in Accellion File Transfer Appliance (FTA) that led to remote code execution, allowing him to take over files.fb.com. While investigating, he discovered webshells and a credential-logging backdoor left by a previous attacker, which had captured around 300 Facebook employee credentials.
Published on devco.re
Tech Editorials #Facebook #BugBounty #RCE #Backdoor #Reconnaissance #Pentest
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 an account of a penetration test against Facebook's external estate that started from reconnaissance and ended with a pre-authentication SQL injection leading to remote code execution on an Accellion File Transfer Appliance (FTA). The appliance was reachable at files.fb.com and presented a login interface branded as Accellion Secure File Transfer.
FTA is a product for secure file transfer, online file sharing and syncing, with integration into single sign-on mechanisms including AD, LDAP and Kerberos. The enterprise edition also supports SSL VPN service. The web interface is mainly composed of Perl and PHP, the PHP source is encrypted with IonCube, and a number of Perl daemons run in the background.

The login interface of files.fb.com, identified as Accellion FTA from the logo and footer.
Setup
The researcher's starting point was reconnaissance rather than an account on the target. The approach described is: determine how large the company's territory on the internet is, then look for an entrance. Concretely, the questions asked were:
- What can be found by Google Hacking?
- How many B Class IP addresses are used? How many C Class IPs?
- Whois? Reverse Whois?
- What domain names are used, what are their internal domain names, and what sub-domains can be enumerated?
- What are the preferred techniques and equipment vendors?
- Any data breach on Github or Pastebin?
A Bug Bounty programme bounds what may be tried: the overlap between findings and the permitted actions is the part worth testing. Facebook launched its Bug Bounty Program in 2012.
Reverse Whois turned up an interesting domain name:
tfbnw.net
TFBNW appeared to stand for "TheFacebook Network". Public data then led to:
vpn.tfbnw.net
That host served a Juniper SSL VPN login interface. Its version looked quite new and there was no directly exploitable vulnerability, but it established that TFBNW was an internal domain name for Facebook. Enumerating the C Class IPs of vpn.tfbnw.net surfaced further servers, for example:
- Mail Server Outlook Web App
- F5 BIGIP SSL VPN
- CISCO ASA SSL VPN
- Oracle E-Business
- MobileIron MDM
From the information on these servers, the researcher judged those C Class IPs to be relatively important for Facebook.
For the white-box phase, source code of previous FTA versions was gathered from several resources. The IonCube version used by FTA was not up to date and could be decrypted with ready-made tools, though some details had to be fixed afterwards.
Finding it
Among the C Class IPs there was a special server:
files.fb.com
The first step was to search for publicised exploits. The latest was found by HD Moore and published as Rapid7's advisory "Accellion File Transfer Appliance Vulnerabilities (CVE-2015-2856, CVE-2015-2857)". Whether that vulnerability is exploitable can be determined from the version information leaked by /tws/getStatus. By the time files.fb.com was discovered, the defective v0.18 had already been updated to v0.20.
From the fragments of source code quoted in the advisory, the coding style suggested that security issues would remain in FTA if one kept looking, so the researcher began hunting for 0-day vulnerabilities in the product. Black-box testing found nothing usable, which is why white-box testing followed.
After a simple review of the decrypted code, the assessment was that Rapid7 had probably already taken the easier vulnerabilities, and that the remaining ones needed effort to trigger. Looking deeper produced seven vulnerabilities:
- Cross-Site Scripting x 3
- Pre-Auth SQL Injection leads to Remote Code Execution
- Known-Secret-Key leads to Remote Code Execution
- Local Privilege Escalation x 2
These were reported to the Facebook Security Team, and the product vulnerabilities were also submitted to Accellion Support Team in an advisory. After the vendor patched, they were sent to CERT/CC, which assigned four CVEs:
- CVE-2016-2350
- CVE-2016-2351
- CVE-2016-2352
- CVE-2016-2353
Exploitation
Step 1: Pre-auth SQL injection to write a webshell
The chain used against files.fb.com was the pre-authentication SQL injection, which leads to remote code execution. The report illustrates the result with a screenshot of the injection being used to write a webshell.

Using the pre-auth SQL injection to write a webshell.
The specific request and payload are not reproduced in the report; the published detail is the class of vulnerability and its outcome, with fuller technical detail deferred until after the full disclosure policy allowed it.
Step 2: Survey the server environment
After taking control of the server, the first task was to check how friendly the environment was. Staying on the server longer requires familiarity with the environment, restrictions and logs, and an effort not to be detected. The restrictions found were:
- Firewall outbound connection unavailable, including TCP, UDP, port 53, 80 and 443
- Remote Syslog server
- Auditd logs enabled
Although outbound connections were unavailable, ICMP tunnelling appeared to work. Since this was only a Bug Bounty Program, a webshell was sufficient to control the server.
Step 3: Notice the logs
While collecting vulnerability details and evidence for the report to Facebook, strange things turned up in the web log. First, strange PHP error messages in /var/opt/apache/php_error_log looked as if they had been caused by modifying code online.

The PHP error log.
Step 4: Find the previous visitor's files
Following the PHP paths in the error messages led to suspicious webshell files left by previous "visitors".

A webshell on the Facebook server.
Some of the file contents were as follows:
sshpass
Right, THAT sshpass
- bN3d10Aw.php
- uploader.php
- d.php
- sclient_user_class_standard.inc
The first few are typical PHP one-line backdoors. The exception is sclient_user_class_standard.inc: in include_once there was an sclient_user_class_standard.inc.orig, the original PHP application for password verification, and the hacker had created a proxy in between to log GET, POST and COOKIE values while important operations were under way.
In short, the hacker created a proxy on the credential page to log the credentials of Facebook employees. The logged passwords were stored under the web directory so the hacker could fetch them with WGET every once in a while:
wget https://files.fb.com/courier/B3dKe9sQaa0L.log

The logged passwords.
Besides the logged credentials, the log contained the contents of letters requesting files from FTA, and the logged credentials were rotated regularly.
At the time of discovery there were around 300 logged credentials dated between February 1st and 7th, mostly @fb.com and @facebook.com. FTA has two main login modes:
- Regular users sign up: their password hash is stored in the database, hashed and encrypted with SHA256+SALT
- All Facebook employees (
@fb.com) used LDAP and authenticated by AD Server
The researcher believed these logged credentials were real passwords and guessed they could give access to services such as Mail OWA and VPN for advanced penetration.
The previous hacker was also careless in two ways:
- The backdoor parameters were passed through the GET method, so the footprinting is easy to identify in the web log
- When sending commands, STDERR was not handled, leaving many command error messages in the web log that revealed the operations
From access.log, every few days the hacker cleared all the credentials he had logged.
Step 5: Reconstruct the previous intrusion
The log showed the hacker packing files, enumerating the internal network architecture, and using a shell script to scan the internal network without redirecting STDERR.

The internal network scan, with STDERR left in the log.
Further entries showed an attempt to connect to an internal LDAP server, an attempt to access an internal server (it looked like Mail OWA could be accessed directly), and an attempt to steal the SSL private key. After checking the browser, the SSL certificate of files.fb.com was *.fb.com.

The certificate of files.fb.com.
Root cause
The report attributes the entry point to a pre-authentication SQL injection in Accellion FTA, which can be turned into remote code execution, for example by writing a webshell. The exact vulnerable code is not shown; the published detail is the vulnerability class and the fact that it was found through white-box review of decrypted IonCube-protected PHP after black-box testing failed.
The second issue concerns the credential page: the previous hacker replaced the password verification include with a proxy that logged GET, POST and COOKIE values, and the resulting log was written under the web directory, so it could be retrieved over HTTP. The report does not describe the file permissions or checks that should have prevented this.
After taking control, the report notes the firewall blocked outbound TCP and UDP including ports 53, 80 and 443, but ICMP tunnelling appeared to work, and a webshell was enough for control. Remote syslog and auditd were enabled, and the previous hacker's mistakes (GET parameters, unredirected STDERR) were what made the activity visible in the logs.
Impact
On files.fb.com, the pre-auth SQL injection gave remote code execution on the appliance, demonstrated by writing a webshell.
The logs held around 300 logged credentials dated between February 1st and 7th, mostly @fb.com and @facebook.com, recorded by a proxy on the credential page. The researcher believed these were real passwords and guessed they could be used against Mail OWA and VPN, but that is stated as a guess, not as a verified result. The same logs showed attempts to enumerate the internal network, reach an internal LDAP server, access an internal server that looked like Mail OWA, and steal the SSL private key; the certificate was *.fb.com.
Fix
The vulnerabilities were reported to the Facebook Security Team and submitted to Accellion Support Team in an advisory; the vendor patched them, after which CERT/CC assigned CVE-2016-2350 through CVE-2016-2353. The report does not describe the individual patches.
Variants to test
- Check
/tws/getStatuson an Accellion FTA instance to read the leaked version, which the report says determines whether the known vulnerability is exploitable. - Look for
sclient_user_class_standard.inc.origand a siblingsclient_user_class_standard.incon an FTA host. A positive result is an.origfile next to a modified include, which suggests a credential-logging proxy. - Request files under the web-accessible
courier/directory, for example a.logname, and see whether credentials are served. A positive result is a log containing GET, POST or COOKIE values from the login flow. - Review
php_error_logandaccess.logfor GET-based backdoor parameters and command errors without STDERR redirection. A positive result is a sequence of requests that map to shell commands and their error output. - Test whether outbound TCP, UDP and ports 53, 80 and 443 are blocked but ICMP is allowed. The report says ICMP tunnelling appeared to work.
Timeline
- 2016/02/05 20:05 Provide vulnerability details to Facebook Security Team
- 2016/02/05 20:08 Receive automatic response
- 2016/02/06 05:21 Submit vulnerability Advisory to Accellion Support Team
- 2016/02/06 07:42 Receive response from Thomas that inspection is in progress
- 2016/02/13 07:43 Receive response from Reginaldo about receiving Bug Bounty award $10000 USD
- 2016/02/13 Asking if there anything I should pay special attention to in blog post ?
- 2016/02/13 Asking Is this vulnerability be classify as a RCE or SQL Injection ?
- 2016/02/18 Receive response from Reginaldo about there is a forensics investigation, Would you be able to hold your blog post until this process is complete?
- 2016/02/24 Receive response from Hai about the bounty will include in March payments cycle.
- 2016/04/20 Receive response from Reginaldo about the forensics investigation is done
What happened, in plain words
A security researcher spent time looking at what Facebook had exposed on the public internet. He found a file-sharing server called files.fb.com that was running a product made by a company called Accellion. That product had a serious flaw: someone could send it a specially crafted request, without logging in, and make it run code on the server. The researcher used that flaw to put a small program on the server that let him control it from his browser.
While he was poking around the server, he found evidence that someone else had already been there. That earlier visitor had left their own small programs behind, and had also quietly changed the login page so that every username and password typed into it was saved to a file. That file could be downloaded over the web. It held around 300 logged credentials dated between February 1st and 7th, mostly @fb.com and @facebook.com. The earlier visitor had also been attempting to scan Facebook's internal network and to steal a private encryption key.
The researcher reported everything to Facebook, and the product maker patched the flaws. Facebook paid a bounty of $10,000. Four CVE numbers were assigned to the product vulnerabilities. This article walks through the whole story from the beginning, explaining each idea as it comes up.

Background: what a penetration test is
A penetration test is an authorised attempt to break into a computer system, done so that the owner can find and fix the weaknesses before a real attacker does. The person doing it is called a penetration tester, or pentester. It is like a locksmith being hired to try every door and window of a building and report which ones open too easily.
A bug bounty programme is a public version of the same idea. A company says: here is what you are allowed to test, and here is how much we pay for each kind of problem you find. Facebook launched its programme in 2012. The researcher says that the programme is what motivated him to start looking at Facebook.
The researcher prefers server-side problems to client-side ones. A server-side problem is a weakness in the machine that stores and serves the data. A client-side problem is a weakness in the software running on a user's own computer, such as a browser. Taking over a server directly, and getting a command shell on it, is the more dramatic outcome. A shell is a text interface where you type commands and the machine runs them; getting one on someone else's server is roughly like being handed the keys to the building.
Step 1: Reconnaissance
Before touching anything, the researcher maps out how much of the internet belongs to the target. This is called reconnaissance, or recon. The questions he asks himself are:
- What can I find by Google Hacking?
- How many B Class IP addresses are used? How many C Class IPs?
- Whois? Reverse Whois?
- What domain names are used? What are their internal domain names? Then proceed with enumerating sub-domains
- What are their preferred techniques and equipment vendors?
- Any data breach on Github or Pastebin?
Each of these needs a little explanation.
An IP address is the numeric address of a machine on the internet, like a postal address for a computer. Addresses are grouped into blocks. A B Class block is a large range (tens of thousands of addresses) and a C Class block is a smaller one (256 addresses). Counting how many blocks a company owns gives a rough idea of how big its presence is.
Whois is a public directory that says who registered a domain name. Reverse Whois turns that around: given a person or company, which domain names did they register? It is a way of finding properties a company owns but has not advertised.
Google Hacking means using search engines cleverly to find pages that were not meant to be public, for example login pages, error messages or directory listings.
Enumerating sub-domains means finding all the names under a company's main domain. If the main domain is example.com, sub-domains might be mail.example.com, vpn.example.com and so on. Each one is a possible entrance.
Looking at Github or Pastebin for data breaches means checking whether someone has accidentally published passwords, keys or internal documents on those public sites.
The researcher stresses that a bug bounty is not a licence to attack anything. You compare what you have found with what the programme permits, and only the overlap is fair game. It is like being allowed to test the locks on the front door but not to climb over the fence into the garden.
He also lists three common weaknesses in large companies, to explain why this kind of work succeeds:
- Network boundary. A big company has tens of thousands of routers, servers and computers. It is impossible to protect every one perfectly. An attacker only needs one weak machine on the edge to get a foothold inside.
- Networking equipment. Routers and similar devices often have only a simple web interface and no fine-grained controls. They are protected mainly by the network around them, and a compromise can go unnoticed.
- People and breached databases. When a company's user data leaks, an attacker can look up an employee's password and, if that employee has remote access, walk straight in.
Step 2: Finding the interesting domain
Using Reverse Whois, the researcher found a domain name that stood out:
tfbnw.net
This is just a domain name, the part of a web address after the @ in an email or after www. in a URL. TFBNW appeared to stand for "TheFacebook Network". The name suggested it was used internally by Facebook rather than by the public.
Public data then led him to a particular machine under that domain:
vpn.tfbnw.net
A VPN, or virtual private network, is a service that lets employees connect securely to the company's internal network from outside. When the researcher opened vpn.tfbnw.net in a browser, he saw the login page of a Juniper SSL VPN. Juniper is a network equipment vendor, and SSL VPN is a common way of providing that remote access over an encrypted web connection.
The version of the software looked quite new, and he could not find a vulnerability he could use directly. But the discovery was still valuable: it confirmed that TFBNW was an internal Facebook domain. That told him the surrounding addresses were worth looking at.
He then enumerated the C Class IP addresses around vpn.tfbnw.net, meaning he looked at the other machines in the same small block of addresses. He found several interesting servers, for example:
- Mail Server Outlook Web App
- F5 BIGIP SSL VPN
- CISCO ASA SSL VPN
- Oracle E-Business
- MobileIron MDM
Outlook Web App is Microsoft's webmail interface. F5 BIGIP and CISCO ASA are two brands of network appliance that provide VPN and traffic management. Oracle E-Business is a suite of business applications. MobileIron MDM is software for managing employees' mobile phones. From the presence of these systems, the researcher judged that this block of addresses was relatively important to Facebook.
Step 3: The special server
Among those addresses he found one that stood out:
files.fb.com

This image shows the login page of files.fb.com. From the logo and the footer, the researcher identified the software as Accellion's Secure File Transfer, which he abbreviates as FTA (File Transfer Appliance).
An appliance here means a ready-made server product sold as a unit, rather than software you install yourself. FTA is a product for secure file transfer, online file sharing and syncing. It also integrates with single sign-on, which is the mechanism that lets an employee use one company account to log in to many different services. The integrations mentioned are AD (Active Directory, Microsoft's directory of company accounts), LDAP (a similar, more general directory protocol) and Kerberos (an authentication protocol). The enterprise edition even supports SSL VPN service.
Under the hood, the researcher describes the product like this:
- Web-based user interfaces were mainly composed of Perl & PHP
- The PHP source codes were encrypted by IonCube
- Lots of Perl Daemons in the background
Perl and PHP are programming languages commonly used for websites. IonCube is a tool that encrypts PHP source code so that customers cannot read it. A daemon is a program that runs in the background without a user watching it.
Step 4: Looking for known bugs first
The first thing the researcher did was search for publicised exploits. An exploit is a ready-made recipe or program that takes advantage of a known flaw. The most recent one he found was by HD Moore, published as a Rapid7 advisory titled "Accellion File Transfer Appliance Vulnerabilities (CVE-2015-2856, CVE-2015-2857)".
A CVE is a public identifier for a security flaw, like a case number for a crime. An advisory is the write-up that describes the flaw and how to fix it.
Whether that particular vulnerability is exploitable can be determined from the version information leaked by /tws/getStatus. This is a URL path on the appliance that reports its version. If you know the version, you know whether the known bug applies. It is like checking the model number on a lock to see whether a known key fits.
By the time files.fb.com was discovered, the defective v0.18 had already been updated to v0.20, so the known bug was closed. But the source code fragments quoted in the advisory showed a coding style that made the researcher think other problems would remain if he kept looking. So he began hunting for 0-day vulnerabilities in the product. A 0-day is a flaw that is not yet publicly known and for which no patch exists.
Step 5: Black-box and white-box testing
There are two ways to look for flaws. Black-box testing means trying things from the outside without seeing the code, like a burglar testing doors without a floor plan. White-box testing means reading the source code, like studying the floor plan.
Black-box testing found nothing usable, so the researcher switched to white-box. To read the code he needed the source of previous FTA versions, which he gathered from several resources. The PHP was encrypted with IonCube, but the version FTA used was not up to date and could be decrypted with ready-made tools. He still had to fix some details afterwards, or the result would be messy.
After a simple review, he thought Rapid7 had probably already taken the easier vulnerabilities, and that the remaining ones would be hard to trigger. So he looked deeper.
Step 6: Seven vulnerabilities
Looking deeper produced seven vulnerabilities:
- Cross-Site Scripting x 3
- Pre-Auth SQL Injection leads to Remote Code Execution
- Known-Secret-Key leads to Remote Code Execution
- Local Privilege Escalation x 2
These need explaining one by one.
Cross-Site Scripting (XSS) is a flaw where a website lets an attacker insert their own code into a page that other users view. The attacker's code then runs in the victim's browser. It is like someone slipping a fake instruction into a noticeboard that everyone reads.
SQL Injection is a flaw where a website builds a database query out of whatever the user typed, without checking it. A database is the organised store of information behind a website, and SQL is the language used to ask it questions. If the site pastes your input straight into the question, you can type extra words that change the question. It is like a form that says "name:" and you write "Alice, and also show me everyone's salary".
Pre-Auth means the flaw can be triggered before logging in. That makes it far more dangerous, because the attacker does not need any account at all.
Remote Code Execution (RCE) means the attacker can make the server run their own code. It is the difference between reading someone's mail and being able to give orders to their staff.
Known-Secret-Key means the product ships with a secret key that is the same on every installation, or that is otherwise guessable. A secret key is like a master password used to sign or encrypt things. If everyone has the same one, it is no secret at all.
Local Privilege Escalation means an attacker who already has a small foothold on the machine can raise their level of permission, for example from an ordinary user to an administrator. It is like a visitor who is allowed into the lobby finding a way into the manager's office.
These were reported to the Facebook Security Team, and the product vulnerabilities were also submitted to Accellion Support Team in an advisory. After the vendor patched, they were sent to CERT/CC, a coordination centre that helps disclose vulnerabilities responsibly, and it assigned four CVE numbers:
- CVE-2016-2350
- CVE-2016-2351
- CVE-2016-2352
- CVE-2016-2353
Step 7: Getting in
The pre-auth SQL injection
The chain used against files.fb.com was the pre-authentication SQL injection, which leads to remote code execution. In other words, the researcher could send a request to the login page, before any login, and the database behind it would run a query of his choosing. The report illustrates the result with a screenshot of the injection being used to write a webshell.
A webshell is a small program placed on a web server that lets an attacker send commands through ordinary web requests. It is like leaving a radio in the building that listens for instructions on a frequency only you use.

This image shows the pre-auth SQL injection being used to write a webshell. The exact request and payload are not reproduced in the report; what is published is the class of vulnerability and its outcome, with fuller technical detail deferred until the full disclosure policy allowed it.
Surveying the server
Once he had control, the first task was to check how friendly the environment was. Staying on a server for long requires knowing its restrictions and its logs, and trying not to be noticed. The restrictions he found were:
- Firewall outbound connection unavailable, including TCP, UDP, port 53, 80 and 443
- Remote Syslog server
- Auditd logs enabled
A firewall is a filter that decides which network traffic is allowed in and out. Outbound means traffic leaving the server. TCP and UDP are the two main ways computers send data to each other. Ports are numbered channels on a machine; port 53 is used for DNS (looking up names), port 80 for ordinary web traffic and port 443 for encrypted web traffic. So the server could not reach out to the internet at all.
A remote Syslog server is a separate machine that collects log messages from many servers, so an attacker cannot simply delete the local log to hide their tracks. Auditd is a Linux service that records detailed system activity. Both of these mean the server was being watched.
Although outbound connections were unavailable, ICMP tunnelling appeared to work. ICMP is the simple protocol used by the ping command to check whether a machine is reachable. A tunnel means hiding another kind of traffic inside it. Since this was only a bug bounty programme, a webshell was enough to control the server, so he did not need to build such a tunnel.
Noticing the logs
While collecting evidence for the report to Facebook, strange things turned up in the web log. First, strange PHP error messages in /var/opt/apache/php_error_log looked as if they had been caused by modifying code online.
A log is a file where a program records what happened. A PHP error log records mistakes made by PHP code. If someone is editing code directly on a live server, the mistakes they make while experimenting show up in that log. It is like finding pencil marks in a library book: someone has been writing in it.

This image shows the PHP error log with those strange messages.
The previous visitor's files
Following the PHP paths in the error messages led to suspicious webshell files left by previous "visitors".

This image shows a webshell found on the Facebook server.
Some of the file contents were as follows:
sshpass
Right, THAT sshpass
- bN3d10Aw.php
- uploader.php
- d.php
- sclient_user_class_standard.inc
sshpass is a real program used to automate SSH logins by supplying a password on the command line. SSH is the standard way to log in to a Linux server remotely. The note "Right, THAT sshpass" is the researcher recognising the tool.
The first few files are typical PHP one-line backdoors. A one-line backdoor is a tiny PHP file that takes a command from the request and runs it on the server. The exception is sclient_user_class_standard.inc: in include_once there was an sclient_user_class_standard.inc.orig, the original PHP application for password verification, and the hacker had created a proxy in between to log GET, POST and COOKIE values while important operations were under way.
include_once is a PHP instruction that loads another file into the running program. The attacker had renamed the original file to .orig and put their own file in its place. Their file loaded the original, so the site kept working, but it also recorded what was sent to it.
GET and POST are the two common ways a browser sends data to a server. GET puts the data in the URL, where it is visible; POST puts it in the body of the request. A COOKIE is a small piece of data a website stores in your browser and that your browser sends back on every request; it is often used to remember that you are logged in. A proxy here means a middleman program that passes requests through while copying them down.
In short, the hacker created a proxy on the credential page to log the credentials of Facebook employees. The logged passwords were stored under the web directory so the hacker could fetch them with WGET every once in a while:
wget https://files.fb.com/courier/B3dKe9sQaa0L.log
This is a single command. wget is a program that downloads a file from a URL. The URL points to a .log file inside the courier directory on files.fb.com. Because the file was stored under the web directory, meaning inside the folder the web server serves, the hacker could fetch it with WGET. The attacker did not need a shell for this; a simple download was enough.

This image shows the logged passwords.
Besides the logged credentials, the log contained the contents of letters requesting files from FTA, and the logged credentials were rotated regularly. Rotated means replaced with new ones on a schedule, so that a stolen copy goes stale.
At the time of discovery there were around 300 logged credentials dated between February 1st and 7th, mostly @fb.com and @facebook.com. FTA has two main login modes:
- Regular users sign up: their password hash is stored in the database, hashed and encrypted with SHA256+SALT
- All Facebook employees (
@fb.com) used LDAP and authenticated by AD Server
A password hash is the result of running a password through a one-way mathematical function. The server stores the hash, not the password, so that a stolen database does not directly reveal passwords. SHA256 is one such function. A salt is a random value added to each password before hashing, so that two users with the same password get different hashes. LDAP and AD Server are the company directory services mentioned earlier.
The researcher believed these logged credentials were real passwords and guessed they could give access to services such as Mail OWA and VPN for advanced penetration. He is careful to mark this as a guess, not a verified result.
The previous hacker was also careless in two ways:
- The backdoor parameters were passed through the GET method, so the footprinting is easy to identify in the web log
- When sending commands, STDERR was not handled, leaving many command error messages in the web log that revealed the operations
Footprinting here means the traces left behind. Because the backdoor took its instructions in the URL, every command appeared as a line in the web server's access log. STDERR is the channel where a program writes its error messages, as opposed to STDOUT where it writes normal output. If you do not redirect STDERR, the errors go to the log too, so the log shows not only what the attacker ran but also what went wrong.
From access.log, every few days the hacker cleared all the credentials he had logged. access.log is the web server's record of every request it received.
Reconstructing the earlier intrusion
The log showed the hacker packing files, enumerating the internal network architecture, and using a shell script to scan the internal network without redirecting STDERR.
Packing files means bundling them into an archive, for example with tar or zip, so they can be moved easily. Enumerating the internal network means mapping which internal machines exist and what they do. A shell script is a text file of commands run in sequence.

This image shows the internal network scan, with STDERR left in the log.
Further entries showed an attempt to connect to an internal LDAP server, an attempt to access an internal server (it looked like Mail OWA could be accessed directly), and an attempt to steal the SSL private key. After checking the browser, the SSL certificate of files.fb.com was *.fb.com.
An SSL certificate is the digital document a website presents to prove its identity and to enable encrypted connections. A wildcard certificate like *.fb.com covers every name ending in .fb.com. The private key is the secret half of that certificate, the part that must never be shared. If an attacker steals it, they can impersonate the site or decrypt traffic. The earlier visitor was attempting to do exactly that.

This image shows the certificate of files.fb.com.
Why it worked
The report attributes the entry point to a pre-authentication SQL injection in Accellion FTA, which can be turned into remote code execution, for example by writing a webshell. The exact vulnerable code is not shown; what is published is the vulnerability class and the fact that it was found through white-box review of decrypted IonCube-protected PHP after black-box testing failed.
The second issue concerns the credential page: the previous hacker replaced the password verification include with a proxy that logged GET, POST and COOKIE values, and the resulting log was written under the web directory, so it could be retrieved over HTTP. The report does not describe the file permissions or checks that should have prevented this.
After taking control, the report notes the firewall blocked outbound TCP and UDP including ports 53, 80 and 443, but ICMP tunnelling appeared to work, and a webshell was enough for control. Remote syslog and auditd were enabled, and the previous hacker's mistakes (GET parameters, unredirected STDERR) were what made the activity visible in the logs.
What the impact was
On files.fb.com, the pre-auth SQL injection gave remote code execution on the appliance, demonstrated by writing a webshell.
The logs held around 300 logged credentials dated between February 1st and 7th, mostly @fb.com and @facebook.com, recorded by a proxy on the credential page. The researcher believed these were real passwords and guessed they could be used against Mail OWA and VPN, but that is stated as a guess, not as a verified result. The same logs showed attempts to enumerate the internal network, reach an internal LDAP server, access an internal server that looked like Mail OWA, and steal the SSL private key; the certificate was *.fb.com.
How it was fixed
The vulnerabilities were reported to the Facebook Security Team and submitted to Accellion Support Team in an advisory; the vendor patched them, after which CERT/CC assigned CVE-2016-2350 through CVE-2016-2353. The report does not describe the individual patches.
Things to check on other installations
- Check
/tws/getStatuson an Accellion FTA instance to read the leaked version, which the report says determines whether the known vulnerability is exploitable. - Look for
sclient_user_class_standard.inc.origand a siblingsclient_user_class_standard.incon an FTA host. A positive result is an.origfile next to a modified include, which suggests a credential-logging proxy. - Request files under the web-accessible
courier/directory, for example a.logname, and see whether credentials are served. A positive result is a log containing GET, POST or COOKIE values from the login flow. - Review
php_error_logandaccess.logfor GET-based backdoor parameters and command errors without STDERR redirection. A positive result is a sequence of requests that map to shell commands and their error output. - Test whether outbound TCP, UDP and ports 53, 80 and 443 are blocked but ICMP is allowed. The report says ICMP tunnelling appeared to work.
Timeline
- 2016/02/05 20:05 Provide vulnerability details to Facebook Security Team
- 2016/02/05 20:08 Receive automatic response
- 2016/02/06 05:21 Submit vulnerability Advisory to Accellion Support Team
- 2016/02/06 07:42 Receive response from Thomas that inspection is in progress
- 2016/02/13 07:43 Receive response from Reginaldo about receiving Bug Bounty award $10000 USD
- 2016/02/13 Asking if there anything I should pay special attention to in blog post ?
- 2016/02/13 Asking Is this vulnerability be classify as a RCE or SQL Injection ?
- 2016/02/18 Receive response from Reginaldo about there is a forensics investigation, Would you be able to hold your blog post until this process is complete?
- 2016/02/24 Receive response from Hai about the bounty will include in March payments cycle.
- 2016/04/20 Receive response from Reginaldo about the forensics investigation is done
Glossary
- 0-day: a security flaw that is not yet publicly known and for which no patch exists.
- Access log: the web server's record of every request it received.
- AD (Active Directory): Microsoft's directory of company accounts and permissions.
- Advisory: a public write-up describing a security flaw and how to fix it.
- Appliance: a ready-made server product sold as a unit, rather than software you install yourself.
- Auditd: a Linux service that records detailed system activity.
- B Class / C Class: large and small blocks of IP addresses; a C Class block has 256 addresses.
- Black-box testing: looking for flaws from the outside without seeing the source code.
- Bug bounty programme: a public scheme where a company pays researchers for reporting flaws within agreed rules.
- Certificate (SSL): the digital document a website presents to prove its identity and enable encryption.
- CERT/CC: a coordination centre that helps disclose vulnerabilities responsibly.
- Cookie: a small piece of data a website stores in your browser and that your browser sends back on every request.
- Cross-Site Scripting (XSS): a flaw where a website lets an attacker insert code into a page that other users view.
- CVE: a public identifier for a security flaw, like a case number.
- Daemon: a program that runs in the background without a user watching it.
- DNS: the system that turns names like
example.cominto IP addresses; it uses port 53. - Domain name: the part of a web address after
www.or after the@in an email. - Enumerating sub-domains: finding all the names under a company's main domain.
- Exploit: a ready-made recipe or program that takes advantage of a known flaw.
- Firewall: a filter that decides which network traffic is allowed in and out.
- Footprinting: the traces an attacker leaves behind.
- FTA (File Transfer Appliance): Accellion's product for secure file transfer, sharing and syncing.
- GET / POST: the two common ways a browser sends data to a server; GET puts it in the URL, POST in the body.
- Google Hacking: using search engines cleverly to find pages that were not meant to be public.
- Hash: the result of running a password through a one-way mathematical function, so the password itself is not stored.
- ICMP: the simple protocol used by
pingto check whether a machine is reachable. - include_once: a PHP instruction that loads another file into the running program.
- IonCube: a tool that encrypts PHP source code so customers cannot read it.
- IP address: the numeric address of a machine on the internet.
- Kerberos: an authentication protocol.
- Known-Secret-Key: a flaw where a product ships with a secret key that is the same everywhere or guessable.
- LDAP: a directory protocol for looking up accounts and other information.
- Local Privilege Escalation: raising your level of permission on a machine you already partly control.
- Log: a file where a program records what happened.
- MDM (Mobile Device Management): software for managing employees' mobile phones.
- One-line backdoor: a tiny PHP file that takes a command from a request and runs it on the server.
- Outbound: network traffic leaving a machine.
- Penetration test: an authorised attempt to break into a system so the owner can fix weaknesses.
- PHP / Perl: programming languages commonly used for websites.
- Port: a numbered channel on a machine; 53 is DNS, 80 is ordinary web, 443 is encrypted web.
- Pre-Auth: can be triggered before logging in.
- Private key: the secret half of an SSL certificate, which must never be shared.
- Proxy: a middleman program that passes requests through while copying them down.
- Reconnaissance (recon): mapping out what belongs to a target before attacking.
- Remote Code Execution (RCE): making a server run the attacker's own code.
- Reverse Whois: given a person or company, finding which domain names they registered.
- Rotated: replaced with new values on a schedule.
- Salt: a random value added to each password before hashing.
- Server-side / client-side: weaknesses in the server versus weaknesses in the user's own software.
- SHA256: a one-way mathematical function used to hash passwords.
- Shell: a text interface where you type commands and the machine runs them.
- Shell script: a text file of commands run in sequence.
- Single sign-on: using one company account to log in to many services.
- SQL: the language used to ask a database questions.
- SQL Injection: a flaw where a website builds a database query out of unchecked user input.
- SSH: the standard way to log in to a Linux server remotely.
- sshpass: a program that automates SSH logins by supplying a password on the command line.
- SSL VPN: a VPN provided over an encrypted web connection.
- STDERR / STDOUT: the channels where a program writes error messages and normal output.
- Syslog: a standard way of sending log messages, often to a separate server.
- TCP / UDP: the two main ways computers send data to each other.
- Tunnel: hiding one kind of traffic inside another.
- VPN: a service that lets employees connect securely to the company's internal network from outside.
- Webshell: a small program on a web server that lets an attacker send commands through ordinary web requests.
- White-box testing: looking for flaws by reading the source code.
- Whois: a public directory that says who registered a domain name.
- Wildcard certificate: a certificate like
*.fb.comthat covers every name ending in.fb.com. - wget: a program that downloads a file from a URL.
- XSS: see Cross-Site Scripting.