mirror of
https://github.com/lunchcat/sif.git
synced 2026-07-28 14:37:01 -07:00
modules/recon/private-key-exposure.yaml flags an exposed PEM private key on the BEGIN PRIVATE KEY marker, so a public key or prose that merely names a key is left alone, then extracts the key type. modules/recon/git-credentials-exposure.yaml flags an exposed git credential store on a remote url that carries an inline password, paired with a guard that drops a url shown inside an html page, then extracts the host the credential reaches. modules/recon/pypirc-exposure.yaml flags an exposed pypirc on an index section paired with a credential field, then extracts the pypi upload token. requiring the credential keeps a bare index listing from being reported. internal/modules/secret_file_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 public key, prose that names a key, a remote url with no password, a pypi section with no credential, a credential shown in an html page, a plain 200 body and a 404, none of which may match. verify: go test ./internal/modules, each matcher, marker, guard and extractor proven to bite (break -> red, restore -> green).
47 lines
1.0 KiB
YAML
47 lines
1.0 KiB
YAML
# Private Key Exposure Detection Module
|
|
|
|
id: private-key-exposure
|
|
info:
|
|
name: Private Key Exposure
|
|
author: sif
|
|
severity: high
|
|
description: Detects an exposed PEM private key that grants ssh or tls access
|
|
tags: [ssh, tls, private-key, secret, exposure, recon]
|
|
|
|
type: http
|
|
|
|
http:
|
|
method: GET
|
|
paths:
|
|
- "{{BaseURL}}/.ssh/id_rsa"
|
|
- "{{BaseURL}}/id_rsa"
|
|
- "{{BaseURL}}/id_ecdsa"
|
|
- "{{BaseURL}}/id_ed25519"
|
|
- "{{BaseURL}}/server.key"
|
|
- "{{BaseURL}}/private.key"
|
|
- "{{BaseURL}}/privkey.pem"
|
|
|
|
matchers:
|
|
- type: status
|
|
status:
|
|
- 200
|
|
|
|
- type: word
|
|
part: body
|
|
condition: or
|
|
words:
|
|
- "-----BEGIN RSA PRIVATE KEY-----"
|
|
- "-----BEGIN OPENSSH PRIVATE KEY-----"
|
|
- "-----BEGIN EC PRIVATE KEY-----"
|
|
- "-----BEGIN DSA PRIVATE KEY-----"
|
|
- "-----BEGIN PRIVATE KEY-----"
|
|
- "-----BEGIN ENCRYPTED PRIVATE KEY-----"
|
|
|
|
extractors:
|
|
- type: regex
|
|
name: key_type
|
|
part: body
|
|
regex:
|
|
- '-----BEGIN ([A-Z0-9 ]+?) PRIVATE KEY-----'
|
|
group: 1
|