Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
cortex9-filelock-sqlite-symlink-follow-model — Offline educational model of CVE-2026-112936 (filelock SQLite symlink follow) | Kitploit
Tools/GitHubGitHub/federiconbaez/cortex9-filelock-sqlite-symlink-follow-model
Static AnalysisVulnerability AnalysisCode AnalysisExploitationBinary AnalysisPapers & ResearchLearning & EducationLabs & Practice
GitHub
federiconbaez/cortex9-filelock-sqlite-symlink-follow-model

cortex9-filelock-sqlite-symlink-follow-model

Offline educational model of CVE-2026-112936 (filelock SQLite symlink follow)

View Repository
12 days agoNot yet reviewed
Share

cortex9-filelock-sqlite-symlink-follow-model

Local lab for CVE-2026-112936 (GHSA-j8f7-rjxc-mr56): filelock's ReadWriteLock keyed its instances by Path(lock_file).resolve() and let sqlite3.connect() open the lock path, so a symlink planted at that path was followed: the process created or locked the file the link pointed to, and repointing the link gave two processes "the" write lock on different files. The fix, commit 4d45e83caf7e (filelock 4.0.9), opens the path with O_NOFOLLOW | O_NONBLOCK, refuses anything that is not a regular file, resolves only the parent for the key and connects SQLite through /proc/self/fd/N. Educational, deterministic, C11 checked with ASan/UBSan. No SQLite, no filelock, no network, no other user. Each case builds its own names inside a fresh mkdtemp() sandbox, runs the two opens with real syscalls and removes the sandbox; the output is labels and sandbox-relative keys only.

Spanish: README.es.md. Exercises: PRACTICE.md.

What is modelled (tied to the diff, src/filelock/_read_write.py)

Diff lineCodeLab
old 212, old 309pathlib.Path(lock_file).resolve()pre key: fl_resolve (non-strict, follows links)
new 224-225, new 322pathlib.Path(_canonical(lock_file)), "resolve only the parent"post key: fl_canonical (parent resolved, name kept)
old 740-746sqlite3.connect(database, ...)pre open: open(name, O_RDWR|O_CREAT|O_NONBLOCK) stand-in
new 54-55_DB_OPEN_FLAGS = O_RDWR|O_CREAT|O_NOFOLLOW|O_NONBLOCKpost open flags, mode 0600 (new 775)
new 776-779if not S_ISREG(os.fstat(fd).st_mode): close, "refusing a non-regular lock database"REFUSED_NONREG
new 753-765, 59hold the fd; target = f"{_FD_DIR}/{fd}" (/proc/self/fd on Linux)reopen action

The GHSA says SQLite's VFS resolves the final symlink in user space, so fs.protected_symlinks and the sticky bit do not stop it; the lab's pre stand-in lets the kernel follow the link instead, which gives the same result in a single-user sandbox. _canonical lives in _api.py, outside the diff: only its comment ("resolve only the parent") is modelled.

Differential evidence (results/)

At the lock pathprepost
symlink to private/pwned.flag (missing), also through a chainFOLLOWED_CREATED, a new file outside the lock pathREFUSED_SYMLINK, nothing created
symlink to an existing file (absolute or relative)FOLLOWED_EXISTING, key = the targetREFUSED_SYMLINK, key = the link
symlink to a FIFO / a directory / itself / a missing directoryOPENED_NONREG / ERR_EISDIR / ERR_ELOOP / ERR_ENOENTREFUSED_SYMLINK
FIFOOPENED_NONREGREFUSED_NONREG
link repointed between two opens (GHSA PoC step 3)EXCLUSION_BROKEN, keys S/a.db and S/b.dbREFUSED
link replaced after validation, then connectREOPEN_FOLLOWED (the name is opened again)REOPEN_SAME_INODE (/proc/self/fd/N)
regular file, missing name, directory, symlinked parent, hard linksame in bothsame in both

results/sweep.csv crosses 13 kinds of object at the lock path. On 400 random setups the tests check that post never creates a name outside the lock path, always refuses a final symlink, and that without a final symlink both versions agree except for non-regular files.

Two cases are observations of the lab, not findings: a hard link at the path (c13) is opened by both versions (O_NOFOLLOW is about symlinks; fs.protected_hardlinks is not modelled), and renaming the lock file away and creating a new one between two opens (s04) splits the inode in both versions; doing that to another user's file in a sticky directory needs rights the lab does not model.

Run

sh scripts/build.sh test              # -Wall -Wextra -Werror, ASan + UBSan
python3 scripts/derive_expected.py | diff - fixtures/expected.tsv
sh scripts/build.sh results /tmp/r && diff -r results /tmp/r
./build/fllab case pre 'F:a.db;L:lock.db>a.db' 'open:lock.db'

fixtures/cases.tsv holds positive, negative, edge and out-of-domain cases with labels derived by hand. fixtures/expected.tsv comes from scripts/derive_expected.py, which runs the same scenarios with Python's os module in its own sandbox and computes the pre key with pathlib's real resolve(); the C tests compare labels and keys against both.

A model is not a finding: see LIMITATIONS.md and SOURCES.md. License: Apache-2.0.

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    1.0k
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    634
  • 3

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    417
  • 4

    jumpserver

    jumpserver/jumpserver

    JumpServer is an open-source Privileged Access Management (PAM) platform that provides DevOps and IT teams with on-demand and secure access to SSH, RDP, Kubernetes, Database and RemoteApp endpoints through a web browser.

    383
  • 5

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    328
  • 6

    SafeLine

    chaitin/safeline

    Self-hosted WAF and reverse proxy that filters malicious HTTP traffic, blocks SQL injection, XSS, and bot attacks, with rate limiting and dynamic HTML/JS encryption.

    288

Explore all tools

Browse our collection of tools

View all tools →
Download Tool