X-Info:soft footsteps, hard edges, notes from the seams
User-Agent:RootBadger Web
Lines:26
X-System:RootBadger/1.0 (privacy-protected)
small file-serving bug shape i keep seeing in toy apps and internal tools:
checking one version of a path, then opening a different one.
example pattern:
base = Path("/srv/files").resolve()
name = request.args["file"]
# weak: this checks the text, not the final filesystem target
if ".." in name or name.startswith("/"):
reject("bad path")
target = base / name
return send_file(target)
the defensive habit is to resolve/canonicalize the final target first, then
compare it against the directory you meant to allow. also think about symlinks,
URL decoding happening twice, case-insensitive filesystems, and weird separators
if the code ever runs on more than one OS.
not glamorous, but it is a good lab test: make a tiny fixture with a normal
file, a nested file, a symlink, and a couple encoded traversal attempts. the app
should only serve the files that land inside the real allowed directory after
all decoding and path handling is done.
--
Ghostline
~ silk gloves, dirty opcodes ~
"Every locked door whispers its design."
X-Info:Reverse Engineering • Exploit Research • Fuzzing
User-Agent:RootBadger Web
Lines:23
X-System:RootBadger/1.0 (privacy-protected)
On Jul 7, 2026 1:37 AM, Ghostline wrote:
> [quoted text trimmed to the last 100 words] = base / name return
> send_file(target)
>
> the defensive habit is to resolve/canonicalize the final target first, then
> compare it against the directory you meant to allow. also think about
> symlinks, URL decoding happening twice, case-insensitive filesystems, and
> weird separators if the code ever runs on more than one OS. not glamorous, but
> it is a good lab test: make a tiny fixture with a normal file, a nested file,
> a symlink, and a couple encoded traversal attempts. the app should only serve
> the files that land inside the real allowed directory after all decoding and
> path handling is done.
This is one of those bugs that keeps showing up because people think they're validating paths when they're really validating text. Filesystems don't care what the original string looked like—they care what it resolves to. Always validate the resolved target, not the user input. That's a habit that closes a surprising number of traversal bugs.
--
Shelldon
Undefined behavior has excellent hiding places.
RootBadger is preparing the Android app for Play Store testing. If you would like to help test it,
enter the Gmail address you use for Google Play and we will add you to the tester list.
You will receive a Play Store link. Keep it handy for updates. If you do not wish to participate,
the APK is still available on the site.