Documentation
¶
Overview ¶
Package engagement models a structured security assessment: the phases it moves through, the facts discovered along the way, and how much of the work is actually done.
A penetration test is not one action but a sequence — map the surface, enumerate what is on it, test each thing, then report. Left to a single prompt, an agent skips ahead: it finds one bug and writes the report while three services sit untouched. The methodology is what keeps the work honest, by tracking which phases have the evidence to be called complete and naming what is left.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ChainRules = []ChainRule{ { Name: "Account takeover", Parts: [][]string{{"idor", "cwe-639", "broken object", "bola"}, {"auth", "session", "password reset", "jwt", "cwe-287", "cwe-640"}}, Impact: "An access-control flaw combined with an authentication weakness lets an attacker take over other users' accounts.", }, { Name: "Cloud credential theft via SSRF", Parts: [][]string{{"ssrf", "cwe-918", "request forgery"}, {"metadata", "169.254.169.254", "imds", "cloud", "instance credential"}}, Impact: "An SSRF that can reach the cloud metadata service yields the workload's credentials and, from there, the account.", }, { Name: "Authenticated RCE", Parts: [][]string{{"auth bypass", "weak auth", "default credential", "cwe-287", "cwe-1391"}, {"rce", "command injection", "deserial", "file upload", "cwe-77", "cwe-78", "cwe-94", "cwe-502"}}, Impact: "An authentication weakness plus a code-execution primitive gives an attacker a shell as the application.", }, { Name: "Stored XSS to session hijack", Parts: [][]string{{"stored xss", "persistent xss", "cwe-79"}, {"session", "cookie", "httponly", "token"}}, Impact: "Stored XSS with reachable session material lets an attacker ride authenticated sessions.", }, { Name: "Privilege escalation to admin", Parts: [][]string{{"privilege", "escalation", "cwe-269", "mass assignment", "cwe-915"}, {"admin", "role", "authorization", "cwe-285", "cwe-863"}}, Impact: "A privilege-handling flaw next to weak authorization elevates a normal user to administrator.", }, { Name: "Exposed secret to lateral movement", Parts: [][]string{{"secret", "api key", "credential", "token", "cwe-200", "cwe-312"}, {"reuse", "lateral", "internal", "pivot", "access"}}, Impact: "A leaked secret that is accepted elsewhere lets an attacker move deeper into the environment.", }, }
ChainRules are the combinations worth flagging. Keywords match finding titles, CWEs, and descriptions case-insensitively.
var KnownTypes = []IntelType{ IntelHost, IntelSubdomain, IntelService, IntelEndpoint, IntelTechnology, IntelCredential, IntelParameter, IntelVulnerability, IntelNote, }
KnownTypes lists the intel types a tool should offer.
var Phases = []Phase{ { Name: "scope", Title: "Scope & Authorization", Summary: "Confirm what is in bounds and that testing is authorized.", Produces: []IntelType{IntelScope}, Roles: []string{"security-recon"}, }, { Name: "recon", Title: "Reconnaissance", Summary: "Probe the given target directly first, then map the wider attack surface: hosts, subdomains, and exposed services.", Requires: []string{"scope"}, Produces: []IntelType{IntelHost, IntelSubdomain}, Roles: []string{"security-recon"}, }, { Name: "enumeration", Title: "Enumeration", Summary: "Identify services, endpoints, and the technology behind them.", Requires: []string{"recon"}, Produces: []IntelType{IntelService, IntelEndpoint, IntelTechnology}, Roles: []string{"security-recon", "security-webapp"}, }, { Name: "mapping", Title: "Input & Parameter Mapping", Summary: "Map the input surface: parameters, forms, and injection points to test.", Requires: []string{"enumeration"}, Produces: []IntelType{IntelParameter}, Roles: []string{"security-webapp", "security-api"}, }, { Name: "access", Title: "Authentication & Access", Summary: "Test authentication and access control; capture credentials and sessions in scope.", Requires: []string{"enumeration"}, Produces: []IntelType{IntelCredential}, Roles: []string{"security-webapp", "security-api", "security-internal"}, }, { Name: "testing", Title: "Vulnerability Testing", Summary: "Probe each surface across the testing areas, and confirm what is real.", Requires: []string{"mapping"}, Produces: []IntelType{IntelVulnerability}, Roles: []string{"security-webapp", "security-api"}, }, { Name: "reporting", Title: "Reporting", Summary: "Compile the confirmed findings into an actionable report.", Requires: []string{"testing"}, Produces: []IntelType{IntelReport}, Roles: []string{"security-report"}, }, }
Phases is the assessment model, in order. It is deliberately a handful of broad stages rather than a rigid checklist: the value is in "you have not enumerated the API you found", not in ticking forty boxes.
var TestingAreas = []TestingArea{ {"authentication", "Authentication", []string{"auth", "login", "password", "mfa", "2fa", "session", "jwt", "credential", "cwe-287", "cwe-384", "cwe-613"}}, {"access-control", "Access Control / Authorization", []string{"authorization", "access control", "idor", "privilege", "escalation", "bola", "bfla", "cwe-285", "cwe-639", "cwe-863", "cwe-284"}}, {"injection", "Injection", []string{"injection", "sqli", "sql", "xss", "command", "template", "ssti", "ldap", "nosql", "xxe", "cwe-89", "cwe-79", "cwe-77", "cwe-78", "cwe-94", "cwe-611"}}, {"ssrf", "SSRF & Request Forgery", []string{"ssrf", "request forgery", "csrf", "redirect", "cwe-918", "cwe-352", "cwe-601"}}, {"business-logic", "Business Logic", []string{"business logic", "logic flaw", "race condition", "workflow", "mass assignment", "cwe-840", "cwe-841", "cwe-362"}}, {"data-exposure", "Sensitive Data Exposure", []string{"exposure", "disclosure", "leak", "sensitive", "secret", "pii", "cwe-200", "cwe-538", "cwe-312"}}, {"configuration", "Security Misconfiguration", []string{"misconfig", "configuration", "header", "cors", "tls", "default", "verbose error", "cwe-16", "cwe-693", "cwe-756"}}, {"components", "Vulnerable Components", []string{"outdated", "vulnerable component", "dependency", "known cve", "version", "cwe-1104", "cwe-937"}}, }
TestingAreas is the coverage checklist, drawn from the common web/app testing categories (OWASP WSTG / Top 10). It is a guide, not a gate.
Functions ¶
func CoveragePercent ¶
func CoveragePercent(states []AreaStatus) int
CoveragePercent is the share of testing areas with evidence, 0–100.
Types ¶
type AreaStatus ¶
type AreaStatus struct {
Area TestingArea
Covered bool
}
AreaStatus pairs a testing area with whether it has evidence yet.
func Coverage ¶
func Coverage(evidence []string) []AreaStatus
Coverage marks each testing area covered when any evidence string mentions one of its keywords. Evidence is typically finding titles, CWEs, and intel values.
type Chain ¶
Chain is a detected combination.
func DetectChains ¶
DetectChains returns the chains whose every part is present in the evidence.
type ChainRule ¶
type ChainRule struct {
Name string
// Each element is a set of keywords; the rule matches when every element
// has at least one keyword present somewhere in the evidence.
Parts [][]string
// Impact is the combined consequence, for the report.
Impact string
}
ChainRule is a pattern of two or more weaknesses that compound.
type Intel ¶
type Intel struct {
ID string `json:"id"`
Type IntelType `json:"type"`
Value string `json:"value"`
Detail string `json:"detail,omitempty"`
Source string `json:"source,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
Intel is one discovered fact.
type IntelType ¶
type IntelType string
IntelType classifies a discovered fact.
const ( IntelScope IntelType = "scope" IntelHost IntelType = "host" IntelSubdomain IntelType = "subdomain" IntelService IntelType = "service" IntelEndpoint IntelType = "endpoint" IntelTechnology IntelType = "technology" IntelCredential IntelType = "credential" IntelParameter IntelType = "parameter" IntelVulnerability IntelType = "vulnerability" IntelReport IntelType = "report" IntelNote IntelType = "note" )
func NormalizeType ¶
NormalizeType maps free text to a known type, defaulting to a note so an odd value is still recorded rather than dropped.
type Phase ¶
type Phase struct {
// Name is the identifier used in status and directives.
Name string
// Title is the human label.
Title string
// Summary is one line: what happens in this phase.
Summary string
// Requires names phases that should complete first. A phase is not blocked
// by an unmet prerequisite — the agent may work out of order — but the
// status says so, which is usually enough to correct course.
Requires []string
// Produces are the intel types that, when present, mark this phase as
// having done its job. Recon is done when there are hosts; enumeration when
// there are endpoints; and so on.
Produces []IntelType
// Roles are the specialists suited to this phase.
Roles []string
}
Phase is one stage of an assessment.
type PhaseState ¶
type PhaseState struct {
Phase Phase `json:"-"`
Name string `json:"name"`
Title string `json:"title"`
Summary string `json:"summary"`
Status PhaseStatus `json:"status"`
Evidence int `json:"evidence"`
Roles []string `json:"roles"`
Requires []string `json:"requires,omitempty"`
}
PhaseState is a phase paired with its computed status and the counts behind it.
func NextStep ¶
func NextStep(states []PhaseState) (PhaseState, string)
NextStep returns the phase the agent should focus on, and a directive.
type PhaseStatus ¶
type PhaseStatus string
PhaseStatus is how far one phase has got.
const ( NotStarted PhaseStatus = "not_started" InProgress PhaseStatus = "in_progress" Complete PhaseStatus = "complete" // Blocked means the phase has produced something but a prerequisite has // not, so the work may be building on sand. Blocked PhaseStatus = "blocked" )
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists intel per session as one JSON file each.
func (*Store) Add ¶
Add records a fact, deduplicating by type and value so re-recording the same endpoint does not inflate the coverage counts.
func (*Store) State ¶
func (s *Store) State(sessionID string, hasScope, hasReport bool) ([]PhaseState, error)
State computes the phase progress for a session. hasScope and hasReport come from outside the intel ledger: scope is configuration, and a written report is a file. Passing them in keeps this package from depending on either.
type TestingArea ¶
TestingArea is one category of the vulnerability-testing phase.