Files
urutau/internal/intel/mitre.go
T
Lucas RayanandClaude Opus 5.5 432f521ed1
Release / Publish tags (push) Successful in 18s
Release / Plan (reuse the published image?) (push) Successful in 5s
Release / ci (push) Successful in 1m47s
Release / Build image (amd64) (push) Successful in 21s
Release / Build image (arm64) (push) Successful in 28s
CI / Format and vet (push) Successful in 23s
CI / Tests (Linux, race detector) (push) Successful in 1m24s
CI / Dependency audit (push) Successful in 24s
CI / Docker image (build and smoke test) (push) Skipped
Release / Gitea release (push) Successful in 5s
feat: 1.4.1 pagination, network probes, survival by blocker, report polish
Backend pagination with one pager for sessions, IPs, campaigns and events;
network probe source (port-scan, T1046, second firewall reason port-scan);
host kit logs inbound probes; urutau call on the report cover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 00:21:43 -03:00

142 lines
3.9 KiB
Go

package intel
import (
"sort"
"strings"
"git.lucasrguerra.dev.br/ciberfauna/urutau/internal/core"
)
// TechCtx carries the extra context Techniques needs.
type TechCtx struct {
Tool string // attack-tool label or User-Agent (any case)
Path string // request path (distinguishes wordpress sub-techniques)
Users int // distinct SSH usernames tried by the source
MaxPerUser int // most attempts against a single username
PriorFails bool // ssh-ok preceded by failures from the same IP
}
var techNames = map[string]string{
"T1190": "Exploit Public-Facing Application",
"T1083": "File and Directory Discovery",
"T1059": "Command and Scripting Interpreter",
"T1059.004": "Unix Shell",
"T1505": "Server Software Component",
"T1505.003": "Web Shell",
"T1552": "Unsecured Credentials",
"T1552.001": "Credentials In Files",
"T1213": "Data from Information Repositories",
"T1595": "Active Scanning",
"T1595.001": "Scan IP Blocks",
"T1595.002": "Vulnerability Scanning",
"T1595.003": "Wordlist Scanning",
"T1110": "Brute Force",
"T1110.001": "Password Guessing",
"T1110.003": "Password Spraying",
"T1087": "Account Discovery",
"T1082": "System Information Discovery",
"T1046": "Network Service Discovery",
"T1078": "Valid Accounts",
}
// TechniqueName returns the official MITRE ATT&CK name of a technique id
// ("" when unknown).
func TechniqueName(id string) string { return techNames[id] }
var (
vulnTools = []string{"nuclei", "nikto", "acunetix", "wpscan", "nessus", "openvas", "sqlmap", "burp", "zap", "w3af", "wapiti", "xray", "jaeles"}
wordTools = []string{"dirbuster", "ffuf", "gobuster", "dirsearch", "feroxbuster", "wfuzz", "dirb"}
ipTools = []string{"masscan", "zgrab", "zmap", "nmap", "shodan", "censys"}
)
func hasTool(tool string, list []string) bool {
for _, t := range list {
if strings.Contains(tool, t) {
return true
}
}
return false
}
func famTechs(fam string, ctx TechCtx) []string {
switch fam {
case FamTraversal:
return []string{"T1190", "T1083"}
case FamLog4Shell, FamSQLi, FamXSS, FamIoTCGI:
return []string{"T1190"}
case FamRCE:
return []string{"T1190", "T1059.004"}
case FamWebshell:
return []string{"T1505.003"}
case FamEnvCreds:
return []string{"T1552.001"}
case FamVCS:
return []string{"T1213", "T1552.001"}
case FamBackup, FamPhpMyAdmin, FamAdminPanel, FamGeneric404:
return []string{"T1595.003"}
case FamWordPress:
p := strings.ToLower(ctx.Path)
switch {
case strings.Contains(p, "wp/v2/users"):
return []string{"T1087"}
case strings.Contains(p, "wp-login.php") || strings.Contains(p, "xmlrpc.php"):
return []string{"T1110.001"}
case strings.Contains(p, "/wp-content/plugins/"):
return []string{"T1595.002"}
}
return []string{"T1595.002"}
case FamActuator:
return []string{"T1595.002", "T1082"}
}
return nil
}
// Techniques maps an event category and family to MITRE ATT&CK technique ids
// (sorted, deduplicated).
func Techniques(cat, fam string, ctx TechCtx) []string {
set := map[string]bool{}
for _, t := range famTechs(fam, ctx) {
set[t] = true
}
tool := strings.ToLower(ctx.Tool)
switch core.Category(cat) {
case core.Scanner:
switch {
case fam == FamPortScan:
set["T1595.001"] = true
set["T1046"] = true
case hasTool(tool, vulnTools):
set["T1595.002"] = true
case hasTool(tool, wordTools):
set["T1595.003"] = true
case hasTool(tool, ipTools):
set["T1595.001"] = true
default:
set["T1595"] = true
}
case core.Exploit:
set["T1190"] = true
case core.BruteForce:
set["T1110.001"] = true
case core.SSHFail:
if ctx.Users >= 5 && ctx.MaxPerUser <= 3 {
set["T1110.003"] = true
} else {
set["T1110.001"] = true
}
case core.SSHProbe:
set["T1595.001"] = true
set["T1046"] = true
case core.SSHOK:
if ctx.PriorFails {
set["T1078"] = true
}
}
out := make([]string, 0, len(set))
for t := range set {
out = append(out, t)
}
sort.Strings(out)
return out
}