A tale of twisted Arbitrary File Read
The application's download parameter was vulnerable to UNC path injection, allowing an attacker to make the server initiate SMB connections to an external host. However, the application appended an 'X' to the requested filename, preventing direct reading of arbitrary files; the author bypassed this by targeting files whose names already end in 'X', such as .aspx source files, and eventually read the application source code containing database credentials.
Published on medium.com
Arbitrary File Read
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
In June 2026 I was pentesting a client and found a web application with a report download feature. The feature takes a filename from the download query parameter and serves the corresponding report in .xls or .doc format. The two URLs the application exposed looked like this:
https://client-app.[redacted]/?download=fname.xls
https://client-app.[redacted]/?download=fname.doc
A parameter that names a file on disk is an obvious place to probe for arbitrary file read, and that is exactly where I started.

The image is a generated illustration for the post: reading arbitrary files, but with a twist that is revealed later.
Setup
The testing was done against the client application at client-app.[redacted]. The main tool for the file read attempts was Burp Collaborator, used to catch out-of-band DNS and SMB traffic. No other tooling, account or role is described in the post.
Finding it
The first probe was a UNC path in the download parameter. The application accepted a valid UNC path and I got a DNS pingback on my Burp Collaborator instance. That confirmed the parameter was being used to build a path that the server tried to resolve, and that the injection point was live.
External requests were blocked from the application, so the Collaborator instance received no SMB requests. That was expected: the DNS lookup happened, but the follow-up SMB connection could not leave the environment.
Exploitation
Step 1: Confirm the UNC path injection
Supplying a UNC path in download produced a DNS pingback to Burp Collaborator. The DNS resolution proves the server processed the attacker-controlled path. The absence of SMB traffic is explained by external requests being blocked from the application, not by the injection failing.
Step 2: Discover the appended character
Every attempt to read a local file failed. The reason was that the application appends an X to the requested filename. For a UNC path this is harmless, because the trailing character does not break the SMB path. For a local file it changes the name into something that does not exist:
C:\Windows\win.ini
C:\Windows\System32\drivers\etc\hosts
became:
C:\Windows\win.iniX
C:\Windows\System32\drivers\etc\hostsX
The developers presumably appended X because the application exports .docx and .xlsx files and X is the common suffix character of both extensions. Whatever the reason, the effect is that an X is appended to any requested path.
Step 3: Try to neutralise the appended character
I tried inserting characters to see how the application handled them: a NULL byte, a newline, a tab, a semicolon, and a colon (the last on the theory that it might be treated as an alternate data stream). None of these worked.
Step 4: Work with the constraint instead of against it
Instead of fighting the X, I accepted that it would always be there and asked a different question: given this vulnerability, which files can I pull out to demonstrate an impact?
The most valuable files on a Windows host are .evtx files, the Windows Event Logs. They contain PowerShell commands and scripts, usernames, domain names, hostnames and other information. Their paths are well known, so no guessing is needed. The problem is that reading them requires high privileges, and the application was not running under a high-privileged account, so requesting them would return nothing.
Step 5: Find readable files whose names end in X
Searching for files that end in X and do not need high privileges to read turned up two:
C:\Windows\System32\ksxbar.ax
C:\Windows\System32\vidcap.ax
Requesting these through the download parameter worked. The impact of reaching only these files is limited, so I kept looking.
Step 6: Read the application source
An .aspx file can also be read, because its name ends in x. To target one I first had to find the webroot path, which I obtained from an error page. With the webroot known, I requested the application's files, using the .asx and .aspx names that appeared in the URL.
This worked, and I read the application source code itself.
Step 7: Pivot from source code to credentials
The ASPX file contained, in its comments, a reference to another file. Reading that file was the jackpot: it held a database connection string containing a public IP address and credentials.
The database was not accessible from outside. I found a way to reach it using another technique, which I plan to cover in a separate post.
Root cause
The download parameter accepts a UNC path and arbitrary local paths, so an attacker can supply them. The application appends an X to the requested name, presumably to match the .docx and .xlsx export formats, and that single character is the only thing that prevented straightforward reads of arbitrary files. It is not a security control: it is a naming convention that happened to break most paths, and it is defeated by any interesting file whose name already ends in x, such as .aspx, .ax and .asx.
Impact
Under the conditions seen here, an attacker can read files on the server whose names end in x and that the application account is permitted to read. That was enough to read the application source code and, through a reference in a comment, a file containing a database connection string with a public IP address and credentials. The database itself was not reachable from outside, so the connection string alone did not give direct access; reaching it required a further technique. Files that need high privileges, such as .evtx logs, could not be read because the application did not run under a privileged account.
Fix
The post does not describe a fix applied by the client.
Variants to test
- UNC path in a file parameter. Supply a UNC path and watch for DNS or SMB callbacks on a Collaborator instance. A DNS hit confirms the path is being resolved; SMB traffic confirms egress is open.
- Appended or prepended characters. If reads fail, compare the requested name with the error or behaviour to work out what the application adds. Then look for files whose names already end in that character.
- Extension-based bypass. On Windows,
.aspx,.ax,.asxand similar names end inx. Enumerate files with that suffix that the service account can read. - Error pages for path disclosure. Trigger errors to obtain the webroot, then request source files under it.
- Source code comments. Read application source and follow references in comments to configuration files, which may contain connection strings and credentials.
- Separator and encoding tricks. Try NULL bytes, newlines, tabs, semicolons and colons (including alternate data stream syntax) to see whether the appended character can be neutralised.
What happened, in plain words
A security tester was hired to attack a company's web application, with permission, to find weaknesses before real criminals do. This kind of job is called penetration testing, or pentesting for short. During the test he found a page that lets you download a report file, and he discovered that he could make the server hand over files it was never supposed to give out. That weakness is called an arbitrary file read: "arbitrary" because the attacker chooses any file, and "read" because the server opens it and sends back its contents.
There was a catch, though. The application always stuck the letter X onto the end of whatever filename was requested. So asking for a normal file like C:\Windows\win.ini actually asked for C:\Windows\win.iniX, which does not exist. Most of the tester's attempts failed because of that one letter. The interesting part of the story is how he stopped fighting the letter and started looking for useful files whose names already end in x. That turned out to include the application's own source code, and from there he reached a file holding database credentials.

The illustration above is a generated image for the post: reading arbitrary files, but with a twist that is revealed as the story goes on.
The setup
The testing happened in June 2026 against a client application reachable at client-app.[redacted].
The main tool used was Burp Collaborator. To understand it, imagine you want to know whether a stranger's computer tried to contact you. You give the stranger an address that belongs to a server you control, and you watch that server's log. If a request shows up, you know the stranger followed your address. Burp Collaborator does this for a tester: it hands out a unique hostname and records any DNS lookups or network connections that arrive at it. DNS is the internet's phone book: it turns a name like example.com into a numeric address. SMB is a Windows file-sharing protocol, the way one Windows machine asks another for a file over the network.
No other tool, account or user role is described in the post.
Finding the weakness
The application had a feature that downloads a report. A report is a document in .xls (a spreadsheet) or .doc (a word processor document) format. The feature worked like this: the browser asks for a URL, and the URL contains a parameter called download whose value is the name of the file to fetch. A parameter is simply a named value in a URL, the part after the ? sign. The two URLs the application exposed looked like this:
https://client-app.[redacted]/?download=fname.xls
https://client-app.[redacted]/?download=fname.doc
Line by line:
https://is the secure web protocol; the browser and server encrypt what they send.client-app.[redacted]is the name of the server./?download=fname.xlsmeans: ask the site's main page, and pass it a parameter nameddownloadwith the valuefname.xls. The server is expected to take that name, find the matching report file on its disk, and send it back.- The second line is the same thing with a
.docfile.
Why start here? Because a parameter that names a file on the server's disk is a classic place to look for an arbitrary file read. If the server trusts the name the user supplies and does not check it, the user can supply a name pointing at something private. It is like a hotel receptionist who fetches "whatever is in room 12" without checking whether the guest is allowed in room 12.
Confirming the weakness exists
The first probe was to put a UNC path into the download parameter. A UNC path is a Windows way of naming a file that lives on another machine on the network, written with two backslashes at the start, like \\server\share\file. When Windows sees one, it tries to contact that server, which means it first has to look up the server's name using DNS.
That is the trick: if the tester supplies a UNC path pointing at a hostname that belongs to his Burp Collaborator instance, and the Collaborator log shows a DNS lookup, then the server must have taken his input and tried to resolve it. The application accepted a valid UNC path and he got exactly that DNS pingback.
External requests were blocked from the application, so the Collaborator instance received no SMB requests. In plain terms: the server looked up the name (DNS), but the follow-up attempt to actually connect and fetch the file (SMB) never left the building, because outbound traffic was filtered. That was expected and does not weaken the finding. The DNS lookup alone proves the server processed the attacker-controlled path.
The twist
Here is where the story turns. The tester knew the weakness was real and within reach, but every attempt to read a local file came back empty. The reason: the application appends an X to the requested filename.
For a UNC path this does no harm, because the extra character does not break the network path. But for a local file it turns the name into something that does not exist:
C:\Windows\win.ini
C:\Windows\System32\drivers\etc\hosts
became:
C:\Windows\win.iniX
C:\Windows\System32\drivers\etc\hostsX
Line by line:
C:\Windows\win.iniis a well-known Windows settings file. It is a favourite test target because it is small, harmless and always present, so if you can read it you have proven file read.C:\Windows\System32\drivers\etc\hostsis the local hosts file, which maps names to addresses on that machine.- The second block shows what the server actually asked for: the same paths with an
Xglued on the end. No file on disk has those names, so the read fails.
The developers presumably added the X because the application exports .docx and .xlsx files, and X is the letter both of those extensions share. It felt like a naming convention rather than a deliberate defence, and the tester notes he had not seen it before.
Trying to cancel out the X
Before changing strategy, he tried to neutralise the extra character. He inserted various characters to see how the application behaved: a NULL byte, a newline, a tab, a semicolon, and a colon. The colon idea was a guess that Windows might treat the text after it as an alternate data stream, a hidden side-channel attached to a file. None of these attempts worked.
Why try these? Because different layers of software treat special characters differently. A NULL byte can sometimes cut a string short in one layer while another layer sees the full text. A newline or tab can confuse parsing. A colon can mean something special on Windows. When one character is in your way, the standard move is to see whether some other character can make the software ignore it. Here, nothing did.
Working with the constraint
So he stopped fighting the X and accepted that it would always be there. The new question was: given this weakness, which files can I pull out to show real impact?
On a Windows machine, the most valuable files for an attacker are .evtx files, the Windows Event Logs. These are the system's diary: they record what happened on the machine, including PowerShell commands and scripts that were run, usernames, domain names, hostnames and much more. Their locations are well known, so no guessing is needed. The problem is that reading them requires high privileges, and the application was not running under a high-privileged account. So even with the right path, the answer would be nothing.
Files whose names already end in X
He searched for files that end in X and do not need high privileges to read. Two turned up:
C:\Windows\System32\ksxbar.ax
C:\Windows\System32\vidcap.ax
Line by line:
C:\Windows\System32\is the folder where most of Windows' core program files live.ksxbar.axandvidcap.axare files whose names end inx. The.axextension is used by Windows for certain media-related components.- Because the application adds an
Xanyway, asking for these names produces a path that still exists, so the read succeeds.
Requesting these through the download parameter worked. But the impact of reaching only these two files is small, so he kept looking.
Reading the application's own code
An .aspx file can also be read, because its name ends in x. .aspx is the file type used for pages in ASP.NET, a framework for building websites on Windows. These files contain the code that makes the site work, so reading them is far more valuable than reading a media component.
To target one, he first had to find the webroot: the folder on the server where the website's files live. He found it from an error page. Error pages often reveal paths, versions or other internal details that the site did not mean to show. With the webroot known, he requested the application's files, using the .asx and .aspx names that appeared in the URL.
This worked, and he read the application source code itself.
From source code to credentials
The ASPX file contained, in its comments, a reference to another file. Comments are notes in code that the computer ignores; developers use them to explain things to each other, and sometimes they mention other files. Reading that referenced file was the jackpot: it held a database connection string containing a public IP address and credentials.
A connection string is the bundle of information a program needs to log in to a database: where the database is and how to authenticate. Credentials means the username and password (or similar secret) used to prove identity. A public IP address is an address reachable from the internet, as opposed to one only visible inside a private network.
The database was not accessible from outside. He found a way to reach it using another technique, which he plans to cover in a separate post.
Why it worked
The download parameter accepts a UNC path or any local path. Validation means checking that input is what it should be. Because it did not, an attacker can supply a UNC path or any local path.
The appended X appears to be a naming convention that happened to break most paths. It is defeated by any interesting file whose name already ends in x, such as .aspx, .ax and .asx.
What the impact was
Under the conditions seen here, an attacker can read files on the server whose names end in x and that the application account is allowed to read. That was enough to read the application source code and, through a reference in a comment, a file containing a database connection string with a public IP address and credentials. The database itself was not reachable from outside, so the connection string alone did not give direct access; reaching it required a further technique. Files that need high privileges, such as .evtx logs, could not be read because the application did not run under a privileged account.
How to fix it
The post does not describe a fix applied by the client.
Things worth testing elsewhere
- UNC path in a file parameter. Supply a UNC path and watch for DNS or SMB callbacks on a Collaborator instance. A DNS hit confirms the path is being resolved; SMB traffic confirms outbound connections are open.
- Appended or prepended characters. If reads fail, compare the requested name with the error or behaviour to work out what the application adds. Then look for files whose names already end in that character.
- Extension-based bypass. On Windows,
.aspx,.ax,.asxand similar names end inx. Enumerate files with that suffix that the service account can read. - Error pages for path disclosure. Trigger errors to obtain the webroot, then request source files under it.
- Source code comments. Read application source and follow references in comments to configuration files, which may contain connection strings and credentials.
- Separator and encoding tricks. Try NULL bytes, newlines, tabs, semicolons and colons (including alternate data stream syntax) to see whether the appended character can be neutralised.
Glossary
- Arbitrary file read: a weakness that lets an attacker make a server open and return any file the attacker names, rather than only the files it was meant to serve.
- Pentesting (penetration testing): authorised, simulated attacks against a system to find weaknesses before real attackers do.
- Parameter: a named value in a URL, appearing after the
?sign, such asdownload=fname.xls. - Query parameter: another name for a parameter in a URL.
- Burp Collaborator: a service that hands out a unique hostname and records any DNS lookups or network connections that reach it, used to detect out-of-band activity.
- Out-of-band: a signal that comes back through a different channel than the main request, such as a DNS lookup triggered on another server.
- DNS: the internet's naming system that turns a hostname into a numeric address.
- DNS pingback: a DNS lookup that arrives at a server you control, proving that some other system tried to resolve a name you supplied.
- SMB: a Windows protocol for sharing files over a network.
- UNC path: a Windows path starting with two backslashes that names a file on another machine, like
\\server\share\file. - Egress filtering: a network rule that blocks outbound connections from a server.
- NULL byte: a character with value zero, sometimes used to cut strings short in one software layer while another sees the full text.
- Alternate data stream: a hidden side-channel attached to a file on Windows, written after a colon in the path.
.evtx: the file format for Windows Event Logs.- Windows Event Logs: the system's record of events on a machine, including commands run, usernames, domain names and hostnames.
- Privileges: the permissions an account has; high privileges mean it can do more, such as read protected system files.
.ax: a Windows file extension used by certain media-related components..aspx: the file type for pages in ASP.NET, a framework for building websites on Windows; these files contain the site's code.- ASP.NET: a Microsoft framework for building web applications.
- Webroot: the folder on a server where a website's files live.
- Source code: the human-readable instructions that make up a program.
- Comment (in code): a note in source code that the computer ignores, used by developers to explain things to each other.
- Connection string: the bundle of information a program uses to connect to a database, including its location and credentials.
- Credentials: the secrets, such as a username and password, used to prove identity.
- Public IP address: an address reachable from the internet, as opposed to one only visible inside a private network.
- Validation: checking that input is what it should be before using it.
- Root cause: the underlying reason a weakness exists, as opposed to its symptoms.
- Impact: the real-world harm a weakness could cause.
.xls/.doc: older Microsoft spreadsheet and word processor file formats..docx/.xlsx: newer Microsoft spreadsheet and word processor file formats; both extensions end inx..asx: a file extension whose name ends inx, mentioned in the post as one of the names that appeared in the URL.