Cross Site Port Attack in Wild
The WordPress xmlrpc.php file was enabled and allowed the pingback.ping method, which made the server fetch a user-supplied URL. An attacker could use this to scan internal and external ports and potentially access internal services.
thehemdeep.medium.com
Published on thehemdeep.medium.com
Bug Bounty
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
Cross Site Port Attack (XSPA) is the name given here to a class of issue where an application takes user supplied URLs, fetches them on the server side, and returns the back end response to the client without verifying or sanitising it. Because the server performs the request, an attacker can use the application as a proxy towards external Internet facing hosts, intranet devices and the web server itself. The responses can then be studied to learn about service availability, such as open ports and banner versions, and in some cases to fetch data from remote services in unconventional ways.
The feature that made this possible on the target was xmlrpc.php, a standard WordPress component. XML-RPC lets data be transmitted with HTTP as the transport and XML as the encoding. WordPress is not a self-enclosed system and occasionally needs to talk to other systems, so this file exists to handle that job. The report gives the example of posting to a site from a mobile device when the computer is not nearby, using the remote access feature that xmlrpc.php enables.
Setup
The target is referred to only as redacted.com. The researcher identified it as a WordPress site using the Wappalyzer addon for recon. The only other tooling mentioned is a server reachable from the Internet, in this case an NGROK tunnel, used to receive the callbacks. No accounts, roles or versions are described.
Finding it
The first step was a direct request to the XML-RPC endpoint to see whether the file was enabled:
The response was the message:
XML-RPC server accepts POST requests only.
This tells the researcher that the file can be called, but only through a POST request. The report notes that this alone is not proof of exploitability: some applications allow xmlrpc.php to be called and the available methods to be listed, yet cannot be exploited because restrictions are configured on the servers. On this target, the file was fully accessible.

Exploitation
Step 1: list the available methods
The request method was changed from GET to POST, and the available methods were listed with the following body:
<methodCall>
<methodName>system.listMethods</methodName>'
<params></params>
</methodCall>
system.listMethods is the XML-RPC introspection call that returns the methods the endpoint exposes. In the returned list, the pingback.ping method was present. Pingback is the WordPress feature that lets one blog notify another that it has linked to one of its articles.

Step 2: make the server call the attacker's host
The researcher then called their own NGROK server, passing a valid post from redacted.com as the second argument, using the following body:
<methodCall>
<methodName>pingback.ping</methodName>
<params><param>
<value><string>http://<YOUR SERVER >:<port></string></value>
</param><param><value><string>http://<SOME VALID BLOG FROM THE SITE ></string>
</value></param></params>
</methodCall>
The researcher called their own NGROK server, passing a valid post from redacted.com as the second argument.

Step 3: read the result
The request arrived on the NGROK server. The report states that if the fault code is greater than 0, the port is open.

Root cause
The vulnerable design is the one described in the summary: the application processes user supplied URLs and does not verify or sanitise the back end response received from remote servers before sending it back to the client. The vulnerable design is the one described in the summary: the application processes user supplied URLs and does not verify or sanitise the back end response before sending it back to the client. The report does not describe any code level detail of the implementation, so the exact validation that is missing is not stated.
Impact
The report lists the following impact, credited to Mr. Jerry Shah:
- Port scanning remote Internet facing servers
- Port scanning Intranet
- Port scanning local web server
- Exploit vulnerable programs running on intranet or on local web server
- Attacking internal and external web applications that are vulnerable to GET parameter based vulnerabilities such as SQLi
- Reading local web server files using the
file:///protocol handler
The researcher considered this sufficient to report and submitted it to a responsible program. The report does not describe the program's response or any remediation.
Fix
Variants to test
- On other WordPress sites, POST the
system.listMethodsbody shown above toxmlrpc.php. A positive result is a method list that includespingback.ping. - Send the
pingback.pingbody with an attacker controlled host and port as the first parameter and a valid post on the target as the second. A positive result is a request arriving at the attacker's listener, with the fault code indicating whether the port is open. - The report lists port scanning of intranet devices and the local web server among the impact.
- The report lists reading local web server files using the
file:///protocol handler among the impact.
What happened, in plain words
A security researcher found that a WordPress website would happily fetch a web address chosen by a stranger, from the inside of the company's network, and then tell the stranger something about what it found there. That is the whole idea behind the bug class described here, called Cross Site Port Attack, or XSPA.
To understand why that matters, imagine a building with a receptionist who will, on request, walk to any room in the building, knock on the door, and come back to tell you whether somebody answered. From outside the building you cannot reach those rooms yourself. But the receptionist can, and the receptionist does not check whether you are allowed to ask. That is roughly what a server side fetch does when it accepts a URL from a user and does not validate it.
The feature that made this possible on the target was xmlrpc.php, a standard file that ships with WordPress. The researcher used it to make the site's own server contact a server the researcher controlled, and the report states that a fault code greater than 0 means the port is open.
Background: the concepts you need
Before walking through the steps, here are the ideas the report relies on, explained from scratch.
What a server is
When you visit a website, your browser asks a computer somewhere else for a page, and that computer sends it back. The computer sending the page is the server. Your browser is the client. Most of the interesting security problems live in the gap between what the client is allowed to ask for and what the server is willing to do.
What a port is
A single server computer can run many services at once: a website, a mail server, a database, an internal admin panel. Each service listens on a numbered channel called a port. The website usually listens on port 80 or 443. Other services use other numbers. If you know which ports are open on a machine, you know which services are running there, which is the first thing an attacker wants to learn. Scanning ports means trying each one to see whether something answers.
What an API is
An API is a way for one piece of software to ask another piece of software to do something, without a human clicking anything. Think of a restaurant: you do not walk into the kitchen, you tell the waiter what you want and the waiter brings it back. The menu of things you can ask for is the API. On the web, an API is usually a URL you send a request to, with some data attached, and it sends a structured answer back.
What XML-RPC is
XML-RPC is an old, simple way for two computers to call functions on each other over the web. The request travels over HTTP, the same protocol your browser uses, and the contents are written in XML, a text format built from tags in angle brackets. You can think of it as a letter with a strict form: a method name (what you want done) and parameters (the details).
What xmlrpc.php is in WordPress
WordPress is a popular system for building blogs and websites. It is not a closed box: sometimes it needs to talk to other systems, for example when you write a post from your phone while your computer is far away. The file xmlrpc.php exists to handle that kind of remote communication. It is a door into the site that accepts structured requests rather than ordinary page views.
What a pingback is
A pingback is a small notification one blog sends to another to say "I linked to your article". It is a courtesy feature. The sending blog tells the receiving blog: here is the page where I mentioned you, and here is the article I mentioned. Pingback allows you to notify other bloggers that you have linked to their article on your website.
What XSPA means
Cross Site Port Attack is the name given here to a class of issue where an application takes user supplied URLs, fetches them on the server side, and returns the back end response to the client without verifying or sanitising it. Because the server performs the request, an attacker can use the application as a proxy towards external Internet facing hosts, intranet devices and the web server itself. The responses can then be studied to learn about service availability, such as open ports and banner versions, and in some cases to fetch data from remote services in unconventional ways.
A proxy, in this context, is a middleman. You cannot reach a machine directly, but the website can, so you ask the website to reach it for you and report back.
What NGROK is
The researcher needed a server on the public Internet that they controlled, to receive the callback from the target. NGROK is a service that creates a tunnel from a public address to a machine you control, so you can watch incoming requests without setting up your own hosting. In this report it is simply the listener: the place where the target's request would arrive if the target made it.
Setup
The target is referred to only as redacted.com. The researcher identified it as a WordPress site using the Wappalyzer addon for recon. Wappalyzer is a browser extension that looks at a website and guesses which technologies it is built with, a bit like reading the ingredients off a menu without going into the kitchen. The only other tooling mentioned is a server reachable from the Internet, in this case an NGROK tunnel, used to receive the callbacks. No accounts, roles or versions are described.

Finding it
The first step was a direct request to the XML-RPC endpoint to see whether the file was enabled:
Line by line: https:// means the request is encrypted in transit. redacted.com is the site. /xmlrpc.php is the specific file being asked about. Typing this into a browser is the simplest possible check: does the door exist, and does it answer at all?
The response was the message:
XML-RPC server accepts POST requests only.
This tells the researcher that the file can be called, but only through a POST request. A POST request is one of the standard ways a browser talks to a server: a GET request is what happens when you type an address and ask to see a page, while a POST request carries a body of data along with it, usually because you are submitting something. The server is saying: I am here, but you have to send me data, not just ask for a page.
The report notes that this alone is not proof of exploitability: some applications allow xmlrpc.php to be called and the available methods to be listed, yet cannot be exploited because restrictions are configured on the servers. On this target, the file was fully accessible. That distinction matters: a door that opens is not the same as a door that leads anywhere useful.
Exploitation
Step 1: list the available methods
The request method was changed from GET to POST, and the available methods were listed with the following body:
<methodCall>
<methodName>system.listMethods</methodName>'
<params></params>
</methodCall>
Line by line: <methodCall> opens the envelope, the way you would start a letter. <methodName>system.listMethods</methodName> names the function being called: system.listMethods is the XML-RPC introspection call that returns the methods the endpoint exposes. Introspection here means the service tells you what it can do, like a restaurant handing you the menu when you ask. <params></params> is an empty parameter list, because this call needs no details. </methodCall> closes the envelope. The stray apostrophe after the method name is present in the report as written.
Why this step: before asking a service to do something, you want to know what it is willing to do. Listing the methods is the cheapest way to find out whether the interesting one is available.
In the returned list, the pingback.ping method was present. Pingback is the WordPress feature that lets one blog notify another that it has linked to one of its articles. That is the method the researcher wanted, because it makes the server go and fetch a URL.

Step 2: make the server call the attacker's host
The researcher then called their own NGROK server, passing a valid post from redacted.com as the second argument, using the following body:
<methodCall>
<methodName>pingback.ping</methodName>
<params><param>
<value><string>http://<YOUR SERVER >:<port></string></value>
</param><param><value><string>http://<SOME VALID BLOG FROM THE SITE ></string>
</value></param></params>
</methodCall>
Line by line: <methodCall> opens the envelope again. <methodName>pingback.ping</methodName> names the pingback function. The first <param> holds the researcher's NGROK address and port. The placeholders <YOUR SERVER > and <port> are where the researcher's own listener address and chosen port go. The second <param> holds a valid post from the site. The closing tags shut the envelope.
The report does not explain why a valid post from the site was passed as the second parameter.

Step 3: read the result
The request arrived on the NGROK server. The report states that if the fault code is greater than 0, the port is open.
A fault code is the error number a service sends back when something goes wrong. It is like knocking on doors and listening for the difference between silence and a muffled reply.

Root cause
The vulnerable design is the one described in the summary: the application processes user supplied URLs and does not verify or sanitise the back end response received from remote servers before sending it back to the client. The vulnerable design is the one described in the summary: the application processes user supplied URLs and does not verify or sanitise the back end response before sending it back to the client. The report does not describe any code level detail of the implementation, so the exact validation that is missing is not stated.
In plain terms, the application processed a user supplied URL and returned the back end response without verifying or sanitising it.
Impact
The report lists the following impact, credited to Mr. Jerry Shah:
- Port scanning remote Internet facing servers
- Port scanning Intranet
- Port scanning local web server
- Exploit vulnerable programs running on intranet or on local web server
- Attacking internal and external web applications that are vulnerable to GET parameter based vulnerabilities such as SQLi
- Reading local web server files using the
file:///protocol handler
A few of those terms deserve a word. An intranet is a company's private network, the machines staff use that are not reachable from the outside Internet. A banner is the greeting a service sends when you connect, often including its name and version, which tells an attacker what software is running. SQLi, or SQL injection, is a bug where user input is pasted into a database query and changes its meaning. The file:/// protocol handler is a way of writing an address that points at a file on the local disk rather than at a website.
The researcher considered this sufficient to report and submitted it to a responsible program.
Fix
Variants to test
- On other WordPress sites, POST the
system.listMethodsbody shown above toxmlrpc.php. A positive result is a method list that includespingback.ping. - Send the
pingback.pingbody with an attacker controlled host and port as the first parameter and a valid post on the target as the second. A positive result is a request arriving at the attacker's listener, with the fault code indicating whether the port is open. - The report lists port scanning of intranet devices and the local web server among the impact.
- The report lists reading local web server files using the
file:///protocol handler among the impact.
Glossary
- API: a defined way for one piece of software to ask another to do something, usually over a URL, with a structured answer back.
- Banner: the greeting a network service sends when you connect, often revealing its name and version.
- Client: the program making a request, usually your browser.
- Cross Site Port Attack (XSPA): a class of issue where an application fetches user supplied URLs on the server side and returns the response without validating it, letting an attacker probe ports and services through the application.
- Fault code: the error number a service returns when a request fails, used here as a signal about whether a port is open.
- GET: the standard request a browser makes when you ask for a page.
- HTTP: the protocol browsers and servers use to exchange requests and responses.
- Intranet: a company's private internal network, not reachable from the public Internet.
- Introspection: a service's ability to tell you what functions it offers.
- NGROK: a service that exposes a machine you control on a public address, used here to receive callbacks.
- Parameter: a detail passed along with a function call, telling it what to act on.
- Pingback: a WordPress feature where one blog notifies another that it linked to an article, causing the receiving blog to fetch the linking page.
- Port: a numbered channel on a computer that a particular service listens on.
- POST: a request that carries a body of data, used when submitting something rather than just asking for a page.
- Proxy: a middleman that makes a request on your behalf and returns the result.
- Recon: the information gathering phase before an attack, such as identifying which software a site runs.
- Server: the computer that answers requests and sends pages or data back.
- SQLi (SQL injection): a bug where user input is inserted into a database query and changes its meaning.
- Wappalyzer: a browser extension that guesses which technologies a website is built with.
- WordPress: a popular system for building blogs and websites.
- XML: a text format for structured data, built from tags in angle brackets.
- XML-RPC: a way for two computers to call functions on each other over HTTP, with requests written in XML.
xmlrpc.php: the WordPress file that handles XML-RPC requests, including pingbacks.