[PR #6958] [CLOSED] bugfix: correct directory traversal checking logic #6246

Closed
opened 2026-05-05 10:53:24 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netblue30/firejail/pull/6958
Author: @JohnyTheCarrot
Created: 11/6/2025
Status: Closed

Base: masterHead: fix/dir-traversal-check


📝 Commits (1)

  • 1552f7c bugfix: correct directory traversal checking logic

📊 Changes

16 files changed (+48 additions, -23 deletions)

View changed files

📝 src/firecfg/main.c (+1 -1)
📝 src/firejail/fs_bin.c (+2 -2)
📝 src/firejail/fs_etc.c (+1 -1)
📝 src/firejail/fs_home.c (+1 -1)
📝 src/firejail/fs_lib.c (+2 -2)
📝 src/firejail/fs_whitelist.c (+1 -1)
📝 src/firejail/main.c (+7 -7)
📝 src/firejail/netfilter.c (+1 -1)
📝 src/firejail/netns.c (+1 -1)
📝 src/firejail/output.c (+1 -1)
📝 src/firejail/profile.c (+4 -3)
📝 src/ftee/Makefile (+3 -0)
📝 src/ftee/main.c (+1 -1)
📝 src/include/common.h (+1 -0)
📝 src/lib/common.c (+19 -0)
📝 src/libtracelog/libtracelog.c (+2 -1)

📄 Description

Fixes #6915

The logic checking for the presence of directory traversal 'tokens' yields false positives.
It is perhaps rare though entirely valid for a filename to contain a double dot.
The linked issue is how it manifested in my usage of Firejail.

I aim to fix this by checking any of the following instead:

  1. the string is a full match of ".."
  2. the string contains "../"
  3. the string ends with "/.."

if I am missing any scenarios in which a '..' would ordinarily be valid, please let me know.
PS: should I add str_ends_with to the common.h header? I figure it couldn't hurt, no? Let me know.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netblue30/firejail/pull/6958 **Author:** [@JohnyTheCarrot](https://github.com/JohnyTheCarrot) **Created:** 11/6/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/dir-traversal-check` --- ### 📝 Commits (1) - [`1552f7c`](https://github.com/netblue30/firejail/commit/1552f7c8ae7bceec092d6dbf29c01722a0ceef0d) bugfix: correct directory traversal checking logic ### 📊 Changes **16 files changed** (+48 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `src/firecfg/main.c` (+1 -1) 📝 `src/firejail/fs_bin.c` (+2 -2) 📝 `src/firejail/fs_etc.c` (+1 -1) 📝 `src/firejail/fs_home.c` (+1 -1) 📝 `src/firejail/fs_lib.c` (+2 -2) 📝 `src/firejail/fs_whitelist.c` (+1 -1) 📝 `src/firejail/main.c` (+7 -7) 📝 `src/firejail/netfilter.c` (+1 -1) 📝 `src/firejail/netns.c` (+1 -1) 📝 `src/firejail/output.c` (+1 -1) 📝 `src/firejail/profile.c` (+4 -3) 📝 `src/ftee/Makefile` (+3 -0) 📝 `src/ftee/main.c` (+1 -1) 📝 `src/include/common.h` (+1 -0) 📝 `src/lib/common.c` (+19 -0) 📝 `src/libtracelog/libtracelog.c` (+2 -1) </details> ### 📄 Description Fixes #6915 The logic checking for the presence of directory traversal 'tokens' yields false positives. It is perhaps rare though entirely valid for a filename to contain a double dot. The linked issue is how it manifested in my usage of Firejail. I aim to fix this by checking any of the following instead: 1. the string is a full match of ".." 2. the string contains "../" 3. the string ends with "/.." if I am missing any scenarios in which a '..' would ordinarily be valid, please let me know. PS: should I add `str_ends_with` to the common.h header? I figure it couldn't hurt, no? Let me know. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 10:53:24 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#6246
No description provided.