Skip to content

Traversal filter bypass with ....// and ..;/ sequences

A traversal filter bypass abuses a filter that strips ../ only once (non-recursively): payloads like ....// or ..././ are built so that, after the filter deletes the ../ it recognises, the leftover characters reassemble into a valid ../ sequence. Related tricks use ..;/ or mixed separators to slip past naive blocklists.

Linux / UnixWindowsArbitrary file readInformation disclosureFilter stripping

How it works

A common but broken defence is to delete ../ from the input in a single pass. If the deletion is not applied repeatedly until the string stops changing, carefully overlapping sequences survive it.

Take ....//: the filter finds the inner ../ (characters 3–5) and removes it, leaving ../ — a working traversal. Likewise ..././ collapses to ../ after one removal pass. The attacker encodes the removal into the payload itself.

Separator and path-parameter tricks round this out: ..;/ abuses servers (notably some Tomcat/Java setups) that treat ; as a path-parameter delimiter, and mixing / with \ (..\/) can slip past filters that only know one separator.

When it works and when it fails

Works when

  • The filter removes or replaces ../ in a single, non-recursive pass.
  • The filter knows only one separator or one exact sequence (e.g. matches '../' but not '..\' or '..;/').
  • No canonicalization/allowlist runs after the stripping step.

Fails when

  • The filter loops until the string is unchanged, or (better) canonicalizes and does a prefix check.
  • Input is resolved through an allowlist of keys, not sanitised as a path.
  • The server does not honour path parameters (;), closing the ..;/ variant.

Representative payloads

Adapt these to your authorized target; they are shown in canonical form. Payloads are never translated.

  • ....//....//....//etc/passwd
    Linux / UnixFilter stripping

    After a single non-recursive removal of ../, each ....// collapses to ../, yielding a working traversal.

  • ..././..././..././etc/passwd
    Linux / UnixFilter stripping

    Another self-healing form: removing the recognised ../ once leaves ../ behind.

  • ..;/..;/..;/etc/passwd
    Any OSFilter stripping

    Uses the ; path-parameter delimiter honoured by some servers (e.g. Tomcat) so ..;/ is treated as traversal while bypassing a '../' blocklist.

  • ..\/..\/..\/etc/passwd
    WindowsFilter stripping

    Mixes separators so a filter that only matches one of / or \ misses the sequence while the OS still traverses.

Detection

In logs

  • Overlapping dot/slash patterns: ....// , ..././ , ...\.\ in parameters.
  • Path-parameter traversal: ..;/ in request paths or parameters.
  • Mixed / and \ separators combined with dot sequences.

In code

  • str_replace/replace calls that delete '../' once instead of looping to a fixed point.
  • Blocklists that match a single literal sequence or a single separator.
  • Sanitisation used as the only control, with no canonicalization + prefix check afterwards.

Detection rule: Match the self-healing forms (\.{2,}[\\/]+)+ and ..;/ ; treat sanitisation failures by switching to canonicalize-then-validate.

Remediation

  • Never 'clean' traversal by deleting ../ — it is inherently bypassable. Canonicalize (realpath/normalize) and verify the result is within the base directory instead.
  • If you must filter, apply the replacement repeatedly until the string no longer changes, then still validate the canonical path.
  • Resolve a request key through an allowlist map to a fixed path so no sanitisation of a path is needed.
  • Disable path-parameter handling (;) where not required, and normalise separators before any check.

Vulnerable (javascript)

// non-recursive strip: '....//' -> '../'
const clean = req.query.f.replace(/\.\.\//g, '');
fs.readFile(path.join(BASE, clean), cb);

Fixed

const full = path.resolve(BASE, decodeURIComponent(req.query.f));
if (!full.startsWith(BASE + path.sep)) return res.sendStatus(400);
fs.readFile(full, cb);

Replace brittle stripping with canonicalize-then-prefix-check, which no overlapping sequence can defeat.

FAQ

Why does ....// defeat a ../ filter?
A non-recursive filter removes the inner ../ once and stops. The characters left on either side (.. and /) join into a fresh ../, so the traversal survives the single cleaning pass.

References