Files
sif/modules/recon/mercurial-exposure.yaml
T
TigahandGitHub cf159ad4a9 feat(modules): add svn, mercurial and bazaar exposure modules (#210)
modules/recon/svn-exposure.yaml flags an exposed .svn working copy through the
wc.db sqlite header anchored at the first byte paired with a working copy table
name, so a generic sqlite database is not reported, then extracts the
repository url.

modules/recon/mercurial-exposure.yaml flags an exposed .hg repository through
the revlog format requirements that the requires file lists, so prose that
names mercurial is not reported, then extracts the requirement.

modules/recon/bazaar-exposure.yaml flags an exposed .bzr repository through the
Bazaar meta directory signature, so a page that names a bazaar is not reported,
then extracts the format.

internal/modules/vcs_metadata_exposure_test.go drives the three modules end to
end through ExecuteHTTPModule and asserts the leak alongside the near misses a
strict review wants pinned: a generic sqlite database, an unanchored magic,
prose naming mercurial, a marketplace page, an html tutorial for the text
formats, a plain 200 and a 404.

verify: go test ./internal/modules, each matcher and extractor proven to bite
(break -> red, restore -> green).
2026-06-22 18:18:16 -07:00

48 lines
948 B
YAML

# Exposed Mercurial Repository Detection Module
id: mercurial-exposure
info:
name: Exposed Mercurial Repository
author: sif
severity: high
description: Detects an exposed .hg repository through its requires file that may leak source code
tags: [mercurial, hg, exposure, source-code, misconfiguration]
type: http
http:
method: GET
paths:
- "{{BaseURL}}/.hg/requires"
matchers:
- type: status
status:
- 200
- type: word
part: body
condition: or
words:
- "revlogv1"
- "dotencode"
- "fncache"
- "generaldelta"
- "sparserevlog"
- type: word
part: body
negative: true
condition: or
words:
- "<!DOCTYPE"
- "<html"
extractors:
- type: regex
name: hg_requirement
part: body
regex:
- '(revlogv1|dotencode|fncache|generaldelta|sparserevlog|store|treemanifest)'
group: 1