<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-i-found-a-high-severity-directory-traversal-in-flask-admin-w8woksypc" -->

---
title: How I Found a High-Severity Directory Traversal in...
description: A security researcher discovered a high-severity directory traversal vulnerability in Flask-Admin's FileAdmin component by reviewing source code. The flaw...
canonical: https://daily.dev/posts/how-i-found-a-high-severity-directory-traversal-in-flask-admin-w8woksypc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How I Found a High-Severity Directory Traversal in Flask-Admin | daily.dev
og:description: A security researcher discovered a high-severity directory traversal vulnerability in Flask-Admin's FileAdmin component by reviewing source code. The flaw...
og:url: https://daily.dev/posts/how-i-found-a-high-severity-directory-traversal-in-flask-admin-w8woksypc
og:image: https://api.daily.dev/og/posts/W8WoKsYPC.png
og:image:alt: How I Found a High-Severity Directory Traversal in Flask-Admin
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How I Found a High-Severity Directory Traversal in Flask-Admin

**[InfoSec Write-ups](https://daily.dev/sources/infosecwriteups)** · 5 min read · 0 upvotes · 0 comments

## Summary

A security researcher discovered a high-severity directory traversal vulnerability in Flask-Admin's FileAdmin component by reviewing source code. The flaw stems from using Python's startswith() string method to validate filesystem paths — a check that fails when sibling directories share a common prefix (e.g., /data/uploads and /data/uploads_secret). All FileAdmin operations (download, upload, rename, delete, create directory) relied on this flawed is_in_folder() check, meaning the configured root directory boundary could be bypassed entirely. The researcher confirmed the bug with a local test environment using curl --path-as-is, documented it, and submitted via GitHub Security Advisories — only to find it had already been reported as a duplicate.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://infosecwriteups.com/how-i-found-a-high-severity-directory-traversal-in-flask-admin-d3b99b4bec1d>

## Questions this post answers

### Why is using Python's startswith() to validate file paths against a base directory insecure?

Because startswith() performs a plain string comparison, a path like /data/uploads_secret will pass a check against the base directory /data/uploads even though it is a completely different directory. This flaw was found in Flask-Admin's FileAdmin is_in_folder() function, allowing download, upload, rename, delete, and create-directory operations to escape the configured root directory via traversal sequences like ../uploads_secret/flag.txt.

_Auditing path validation logic in your own app? Track filesystem security patterns like this one on daily.dev._

### How can I test for directory traversal when a browser normalizes ../ sequences before sending the request?

Use curl with the --path-as-is flag to preserve the raw traversal sequence in the URL instead of letting the browser normalize it, for example: curl --path-as-is "http://127.0.0.1:5000/admin/files/download/../uploads_secret/flag.txt". This prevents automatic path normalization from hiding the traversal attempt before it reaches the server.

_Testing path traversal payloads yourself? Developers compare tooling tricks like this on daily.dev._

## Similar posts on daily.dev

- [HTB: Imagery](https://daily.dev/posts/htb-imagery-q6xoiousp) · 0xdf hacks stuff · 1 upvotes · 0 comments
- [CVE-2026-22860 \(rack\): Rack has a Directory Traversal via Rack:Directory](https://daily.dev/posts/cve-2026-22860-rack-rack-has-a-directory-traversal-via-rack-directory-je6bnhwzp) · RUBYLAND · 0 upvotes · 0 comments
- [Path traversal flaw in AI dev platform Langflow exploited in attacks](https://daily.dev/posts/path-traversal-flaw-in-ai-dev-platform-langflow-exploited-in-attacks-spteyrcl6) · BleepingComputer · 0 upvotes · 0 comments
- [Path Traversal — A tour to the web server’s assets](https://daily.dev/posts/path-traversal-a-tour-to-the-web-server-s-assets-cjbagv9xd) · InfoSec Write-ups · 0 upvotes · 0 comments
- [Secure File Upload System](https://daily.dev/posts/secure-file-upload-system-kwux4arbu) · Medium · 0 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#vulnerability](https://daily.dev/tags/vulnerability)

[View this post on daily.dev](https://daily.dev/posts/how-i-found-a-high-severity-directory-traversal-in-flask-admin-w8woksypc)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How I Found a High-Severity Directory Traversal in Flask-Admin","url":"https://daily.dev/posts/how-i-found-a-high-severity-directory-traversal-in-flask-admin-w8woksypc","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-i-found-a-high-severity-directory-traversal-in-flask-admin-w8woksypc"},"datePublished":"2026-08-05T07:18:39.904Z","dateModified":"2026-09-13T21:08:10.519Z","description":"A security researcher discovered a high-severity directory traversal vulnerability in Flask-Admin's FileAdmin component by reviewing source code. The flaw...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/9ec4391e707eff7ecde62535c618599c?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/9ec4391e707eff7ecde62535c618599c?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"InfoSec Write-ups","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"InfoSec Write-ups","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/f0dc21b5bbfd46fda36f7b4b53dd1705","url":"https://daily.dev/sources/infosecwriteups"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-i-found-a-high-severity-directory-traversal-in-flask-admin-w8woksypc","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,vulnerability","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"InfoSec Write-ups","item":"https://daily.dev/sources/infosecwriteups"},{"@type":"ListItem","position":3,"name":"How I Found a High-Severity Directory Traversal in Flask-Admin"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-i-found-a-high-severity-directory-traversal-in-flask-admin-w8woksypc#faq","mainEntity":[{"@type":"Question","name":"Why is using Python's startswith() to validate file paths against a base directory insecure?","acceptedAnswer":{"@type":"Answer","text":"Because startswith() performs a plain string comparison, a path like /data/uploads_secret will pass a check against the base directory /data/uploads even though it is a completely different directory. This flaw was found in Flask-Admin's FileAdmin is_in_folder() function, allowing download, upload, rename, delete, and create-directory operations to escape the configured root directory via traversal sequences like ../uploads_secret/flag.txt. Auditing path validation logic in your own app? Track filesystem security patterns like this one on daily.dev."}},{"@type":"Question","name":"How can I test for directory traversal when a browser normalizes ../ sequences before sending the request?","acceptedAnswer":{"@type":"Answer","text":"Use curl with the --path-as-is flag to preserve the raw traversal sequence in the URL instead of letting the browser normalize it, for example: curl --path-as-is \"http://127.0.0.1:5000/admin/files/download/../uploads_secret/flag.txt\". This prevents automatic path normalization from hiding the traversal attempt before it reaches the server. Testing path traversal payloads yourself? Developers compare tooling tricks like this on daily.dev."}}]}
```

