# Path Traversal

*noun*

say it: **“PATH truh-VUR-sul”** **/pæθ trəˈvɝsəl/**

An attack that uses ../ in a file name to reach files outside the folder a server meant to allow.

## What is **path traversal**?

**Path traversal** is an attack that puts `../` in a file name or path to climb out of the folder a server meant to use and reach other files, such as its `.env`. Never build a path from a name the user sent; make the file's name yourself.

```javascript
// a request for "../.env" would reach the server's secrets:
path.join("uploads", "../.env"); // ".env"

// safer: name the file yourself
const saved = path.join("uploads", `${crypto.randomUUID()}.jpg`);
```

## In a sentence

- “A **path traversal** request for ../../.env tried to download the server's secrets.”
- “Naming uploads with random ids closes the **path traversal** hole, because the user's file name is never used.”

Level: Freelancer · [More Web Development terms at this level](https://www.ask-codey.com/glossary?category=web-development&level=4)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/path-traversal
