Blog/Vulnerabilities

Path Traversal: A Solved Problem That Keeps Breaking Things

Directory traversal has been understood for decades and still appears in exploited vulnerability catalogs. Why the fixes fail, and what stops it properly.

CyberWatch AILast reviewed 21 November 2026 · 8 min read
A corridor of numbered doors in an apartment building

In May 2024 CISA and the FBI published something slightly unusual: an advisory aimed not at defenders but at the companies writing the software. The subject was directory traversal, a flaw class documented long before most of the affected products were designed. The alert noted that CISA had by then listed 55 directory traversal vulnerabilities in its Known Exploited Vulnerabilities catalog, that threat actor campaigns exploiting them had compromised software users including critical infrastructure in the healthcare sector, and, pointedly, that "approaches to avoid directory traversal vulnerabilities are known."

That last sentence is the interesting part. This is not an unsolved research problem. The techniques that prevent it were understood decades ago. Pull today's version of the same catalog and count the entries tagged with CWE-22, the identifier MITRE assigns to this weakness, and you get 82. The number went up.

What the flaw is

An application needs to serve a file. It has a directory where the files live, and it receives something from the user indicating which one: a name in a URL, a parameter, an entry in an uploaded archive. It joins the two together and opens the result.

The flaw is that a path is not a name. Paths have syntax, and the syntax includes a way to go up: .. means the parent directory. An input of ../../../../etc/passwd joined onto a documents folder does not refer to a document. It climbs out and lands somewhere else entirely.

MITRE's name for it is precise in a way the casual name is not: improper limitation of a pathname to a restricted directory. The application intended to restrict access to one directory. It failed to enforce that restriction. The .. sequence is how the failure is usually demonstrated, not what the flaw consists of.

Why reading files is enough

Teams sometimes rank an arbitrary file read below code execution, and then handle it at a leisurely pace. That ranking is wrong more often than it is right, because of what lives on disk.

A server's filesystem holds its configuration files, and configuration files hold database connection strings, API keys, service account passwords and signing secrets. It holds private keys for TLS certificates. It holds session databases, from which an attacker can extract live sessions. On a network appliance it holds the credential store for every user of that appliance.

CVE-2019-11510 in Pulse Connect Secure is the illustration most defenders remember. Its CVE record describes the flaw plainly: in Pulse Connect Secure 8.2 before 8.2R12.1, 8.3 before 8.3R7.1, and 9.0 before 9.0R3.4, "an unauthenticated remote attacker can send a specially crafted URI to perform an arbitrary file reading vulnerability." It carries a CVSS version 3.0 base score of 9.9, it was among the first entries in CISA's exploited catalog, and the catalog records known use in ransomware campaigns. A VPN gateway that will hand its own secrets to anyone who asks nicely is not a confidentiality problem. It is an authentication problem, and then it is an everything problem.

CVE-2018-13379 in Fortinet FortiOS has the same shape. The CVE record describes a path traversal under the SSL VPN web portal, in FortiOS 6.0.0 to 6.0.4, 5.6.3 to 5.6.7 and 5.4.6 to 5.4.12 along with several FortiProxy versions, allowing an unauthenticated attacker to download system files via specially crafted HTTP resource requests. It is scored 9.1, it is in the exploited catalog, and it kept appearing in CISA's annual advisories on routinely exploited vulnerabilities years after the fix shipped.

When reading becomes running

Two conditions turn a traversal flaw into code execution, and both appear in real advisories.

The traversal reaches a directory where things are executed. The Apache HTTP Server advisories of October 2021 are the clearest case. The CVE record for CVE-2021-41773 describes a flaw introduced by a change to path normalization in version 2.4.49, where an attacker "could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives." It then states the consequence: "If CGI scripts are also enabled for these aliased pathes, this could allow for remote code execution." The record also states that the issue is known to be exploited in the wild, and that it affects only 2.4.49.

What happened next is the part worth remembering. The fix shipped in 2.4.50, and it was incomplete. CVE-2021-42013 exists because, as its record puts it, "the fix for CVE-2021-41773 in Apache HTTP Server 2.4.50 was insufficient," leaving 2.4.49 and 2.4.50 both affected. Path handling is harder to get right than it looks, and an incomplete first fix is common enough that you should always check whether the version you deployed is the one that actually resolved it.

The flaw allows writing rather than reading alone. Traversal in a file upload destination lets the attacker choose where their file lands, and some destinations are executed. CVE-2024-1708, one of the two examples CISA and the FBI cited in their alert, describes ConnectWise ScreenConnect 23.9.7 and earlier as affected by a path traversal flaw "which may allow an attacker the ability to execute remote code or directly impact confidential data or critical systems," fixed in 23.9.8. Archive extraction belongs in the same bucket, since the entry names inside an archive are attacker-supplied paths and a naive extractor will happily write them wherever they point.

The second example in that alert, CVE-2024-20345 in the Cisco AppDynamics Controller, shows the quieter end of the class: an authenticated remote attacker exploiting insufficient validation in file upload functionality to access sensitive data, scored 6.5. Worth noting that this one is not in the exploited catalog, which is the distinction between a flaw CISA used to make a point about software design and a flaw being used against people.

Why the usual fix does not hold

The instinctive fix is to look for ../ in the input and reject or strip it. This fails because there is no single way to write a path.

  • Percent encoding. %2e%2e%2f is the same sequence after the URL decoder runs. If validation happens before decoding, it sees nothing wrong.
  • Double encoding. The input decodes once into something that still contains an encoded traversal, which a second decoding step then resolves.
  • Alternative separators. Windows accepts both slash directions. Code written and tested on one platform frequently misses the other.
  • Stripping that creates the problem. Removing ../ from ....// leaves ../. A single-pass filter can manufacture the sequence it was removing.
  • Absolute paths. Some join operations discard the base directory when the second argument is absolute, so no traversal sequence is needed at all.
  • Symbolic links. The path contains no traversal and resolves, via a link on disk, somewhere outside the intended tree.

Every item on that list is a filter failing to anticipate a representation. The structural answer is to stop trying to anticipate.

What actually prevents it

  1. Do not let user input into the path at all. Store files under generated identifiers and keep the mapping from user-visible name to stored identifier in a database. If the input is only ever used as a lookup key, no path syntax can be smuggled through it. This is the strongest option and it is usually available for new designs.
  2. Resolve, then verify. Where input must contribute to a path, build the full path, canonicalize it so that links and relative segments are fully resolved, and then check that the result is inside the permitted directory. Reject it if not. This validates the destination rather than the input, which is why it survives encodings nobody thought of.
  3. Allowlist, never denylist. If the valid filenames are a known set or match a strict pattern of permitted characters, enforce that. Denying the bad forms will always be incomplete.
  4. Never trust a client-supplied filename for the destination. Use it for display if you must. Generate the stored name yourself.
  5. Validate archive entries before extraction, rejecting any entry whose resolved destination falls outside the extraction root, and any entry that is a symbolic link pointing outside it.
  6. Run the process with minimal filesystem access. A service account that cannot read the private keys limits what a traversal flaw yields even when one exists. Containers, chroot environments and platform sandboxes all help here, and none of them are a substitute for the first two items. The same containment logic applies at the network level, as our network security guide sets out.

How to handle a traversal advisory

The exploited cases cluster in a predictable place: internet-facing appliances, VPN gateways, file transfer products and remote access tools. If one of those is in your estate, treat a traversal advisory with the urgency of a remote code execution advisory, because for an attacker the two are close to equivalent.

Our endpoint security guide covers detecting the file access and process behavior that follows a successful read. Three questions beyond the usual ones are worth asking. Does the flaw allow writing as well as reading, since that raises it further. Is the fixed version the first attempt or a second one, because an incomplete initial patch is common in this class. And if the advisory or CISA's catalog indicates exploitation occurred, what on that device's filesystem would now be considered compromised? For an appliance holding a credential store, the honest answer is usually all of it, and the response includes rotating those credentials rather than only applying the update. Our vulnerability management guide covers tracking that second task so it does not get closed with the patch ticket.

Checking a suspicious link rather than a server? Paste it into CyberWatch AI Scan for a free check.

The short version

Path traversal is a failure to confine a path to the directory it was supposed to stay in. The .. sequence is the familiar demonstration, not the flaw, which is why filtering for it keeps failing against encodings and alternative forms.

Reading arbitrary files is usually sufficient for full compromise, because credentials and keys live on disk. Writing arbitrary files, or traversing into a directory where code is executed, makes it remote code execution outright. The fixes are well established: keep user input out of paths, or resolve the path and confirm where it landed before opening it. The fact that this class still fills exploited vulnerability catalogs is a comment on software development practice rather than on the difficulty of the problem. For how these flaws get ranked against everything else competing for attention, see our vulnerability management guide, and for the entry-point question more generally, our explainer on remote code execution.

Frequently asked questions

What is path traversal?

A flaw where user-supplied input is used to build a file path, and the input can escape the directory the application intended. The classic form uses sequences such as ../ to climb out of the intended folder and reach files elsewhere on the system.

Is path traversal the same as directory traversal?

Yes. The two names are used interchangeably, and MITRE tracks the weakness as CWE-22, improper limitation of a pathname to a restricted directory. CISA and the FBI used the term directory traversal in their joint advisory on the class.

How does reading a file become a full compromise?

Because the interesting files are credentials. Configuration files with database passwords, private keys, session databases and token stores all sit on disk. An attacker who can read arbitrary files usually does not need to exploit anything else.

Can path traversal lead to code execution?

Yes, in two ways. If the flaw allows writing rather than only reading, the attacker can place a file somewhere that gets executed. And if traversal reaches a directory where scripts are run, as with CGI, reading turns into execution. The Apache HTTP Server advisories of 2021 describe exactly that condition.

Why does filtering out ../ not fix it?

Because there are many ways to express the same path: URL encoding, double encoding, alternative separators, absolute paths, and Unicode forms. Each filter addresses the forms its author thought of. Resolving the path and checking where it actually landed addresses all of them.

Do file uploads have this problem too?

Frequently. If the filename supplied by the client is used to decide where the file is written, traversal in the filename chooses the destination. Archive extraction is the same problem, since entry names inside a zip file are attacker-controlled paths.

Is this only a web application issue?

No. Any component that maps external input to a filesystem path can have it, including network appliance management interfaces, file transfer products, backup agents, and anything that unpacks an archive. Many of the most heavily exploited cases have been appliances rather than custom applications.

What should I check first on my own systems?

Internet-facing appliances and file transfer products, because that is where the exploited cases cluster. Then any application feature where a filename, path or archive supplied by a user influences where a file is read from or written to.

Sources

  1. Secure by Design Alert: Eliminating Directory Traversal Vulnerabilities in Software, US Cybersecurity and Infrastructure Security Agency
  2. CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), MITRE
  3. CVE-2021-41773, CVE Program
  4. CVE-2021-42013, CVE Program
  5. CVE-2019-11510, CVE Program
  6. CVE-2018-13379, CVE Program
  7. Known Exploited Vulnerabilities Catalog, US Cybersecurity and Infrastructure Security Agency
  8. 2023 Top Routinely Exploited Vulnerabilities, US Cybersecurity and Infrastructure Security Agency
Share this article
LinkedIn WhatsApp X
For organizations

Your people get these messages at work too.

CyberWatch AI sends your staff realistic practice attacks, trains the gaps it finds, and shows management exactly where the organization stands.