filesig

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package filesig provides shared structural confirmation that a leaked server-side file's real content appears in a response. It is the single source of truth for the LFI / path-traversal / file-read scanner modules (lfi_path_traversal, mcp_resource_fuzz, mcp_tool_fuzz, …) so they don't each re-implement — and drift on — "does this body actually contain /etc/passwd?".

Every confirmer requires the file's actual structural shape (a real passwd account line, a bracketed win.ini section, an anchored nginx/apache directive) and subtracts the baseline, replacing the bare-word substring markers that modules historically used. Bare words ("root:", ":0:0:", "/bin/", "server", "location", "fonts", "extensions") are ordinary English / appear in CSP directives, JSON keys, error strings, and HTML, so they matched responses that contain no file content at all. The motivating false positive: a Cloudflare 403 "Blocked Content" page whose embedded cf-beacon JSON carried "server_timing" and "location_startswith" satisfied an LFI module's bare "server"/"location" nginx.conf markers and was reported as High/Firm LFI.

These confirmers do NOT inspect the response status — a caller that fronts a WAF/CDN must still reject blocked / challenge / 4xx-5xx responses before confirming (see infra.IsBlockedResponse). Structural confirmation and the status gate are complementary: the gate drops the edge talking, the confirmer drops everything that does not carry the file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfirmAccessLog

func ConfirmAccessLog(data, baseline string) (bool, int)

ConfirmAccessLog confirms a leaked access log by two distinct request lines.

func ConfirmApacheConf

func ConfirmApacheConf(data, baseline string) (bool, int)

ConfirmApacheConf confirms a leaked Apache config by two distinct directives.

func ConfirmBootIni

func ConfirmBootIni(data, baseline string) (bool, int)

ConfirmBootIni confirms a leaked boot.ini by its two canonical sections.

func ConfirmDotenv

func ConfirmDotenv(data, baseline string) (bool, int)

ConfirmDotenv confirms a leaked .env by two distinct sensitive assignments.

func ConfirmEnviron

func ConfirmEnviron(data, baseline string) (bool, int)

ConfirmEnviron confirms a leaked /proc/self/environ by two distinct env vars.

func ConfirmGitHead

func ConfirmGitHead(data, baseline string) (bool, int)

ConfirmGitHead confirms a leaked .git/HEAD by its symbolic-ref line.

func ConfirmHosts

func ConfirmHosts(data, baseline string) (bool, int)

ConfirmHosts confirms a leaked /etc/hosts by the localhost-mapping anchor.

func ConfirmHtpasswd

func ConfirmHtpasswd(data, baseline string) (bool, int)

ConfirmHtpasswd confirms a leaked .htpasswd by a hashed credential line.

func ConfirmNginxConf

func ConfirmNginxConf(data, baseline string) (bool, int)

ConfirmNginxConf confirms a leaked nginx config by two distinct directives.

func ConfirmPasswd

func ConfirmPasswd(data, baseline string) (bool, int)

ConfirmPasswd confirms a leaked /etc/passwd: a root uid 0/gid 0 entry with a terminated shell field must appear that is absent from the baseline.

func ConfirmProcVersion

func ConfirmProcVersion(data, baseline string) (bool, int)

ConfirmProcVersion confirms a leaked /proc/version by the kernel banner.

func ConfirmShadow

func ConfirmShadow(data, baseline string) (bool, int)

ConfirmShadow confirms a leaked /etc/shadow by a new crypt-hash line.

func ConfirmWebXML

func ConfirmWebXML(data, baseline string) (bool, int)

ConfirmWebXML confirms a leaked web.xml by its open+close root element.

func ConfirmWinIni

func ConfirmWinIni(data, baseline string) (bool, int)

ConfirmWinIni confirms a leaked win.ini by two distinct bracketed sections.

Types

type ConfirmFunc

type ConfirmFunc func(data, baseline string) (ok bool, score int)

ConfirmFunc structurally corroborates that a leaked file's real content appears in data and was not already present in baseline. It returns whether the read is confirmed and a score (the number of distinct new, file-shaped matches) callers can use to grade confidence (e.g. >=3 ⇒ Certain).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL