Sudo Heap-Based Buffer Overflow Attempt

Identifies the attempted use of a heap-based buffer overflow vulnerability for the Sudo binary in Unix-like systems (CVE-2021-3156). Successful exploitation allows an unprivileged user to escalate to the root user.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2021/02/03"
 3integration = ["endpoint"]
 4maturity = "production"
 5updated_date = "2024/05/21"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10Identifies the attempted use of a heap-based buffer overflow vulnerability for the Sudo binary in Unix-like systems
11(CVE-2021-3156). Successful exploitation allows an unprivileged user to escalate to the root user.
12"""
13false_positives = [
14    """
15    This rule could generate false positives if the process arguments leveraged by the exploit are shared by custom
16    scripts using the Sudo or Sudoedit binaries. Only Sudo versions 1.8.2 through 1.8.31p2 and 1.9.0 through 1.9.5p1 are
17    affected; if those versions are not present on the endpoint, this could be a false positive.
18    """,
19]
20from = "now-9m"
21index = ["auditbeat-*", "logs-endpoint.events.*"]
22language = "kuery"
23license = "Elastic License v2"
24name = "Sudo Heap-Based Buffer Overflow Attempt"
25references = [
26    "https://cve.mitre.org/cgi-bin/cvename.cgi?name=2021-3156",
27    "https://blog.qualys.com/vulnerabilities-research/2021/01/26/cve-2021-3156-heap-based-buffer-overflow-in-sudo-baron-samedit",
28    "https://www.bleepingcomputer.com/news/security/latest-macos-big-sur-also-has-sudo-root-privilege-escalation-flaw",
29    "https://www.sudo.ws/alerts/unescape_overflow.html",
30]
31risk_score = 73
32rule_id = "f37f3054-d40b-49ac-aa9b-a786c74c58b8"
33severity = "high"
34tags = [
35    "Domain: Endpoint",
36    "OS: Linux",
37    "OS: macOS",
38    "Use Case: Threat Detection",
39    "Tactic: Privilege Escalation",
40    "Use Case: Vulnerability",
41    "Data Source: Elastic Defend",
42]
43timestamp_override = "event.ingested"
44type = "threshold"
45
46query = '''
47event.category:process and event.type:start and
48  process.name:(sudo or sudoedit) and
49  process.args:(*\\ and ("-i" or "-s"))
50'''
51
52
53[[rule.threat]]
54framework = "MITRE ATT&CK"
55[[rule.threat.technique]]
56id = "T1068"
57name = "Exploitation for Privilege Escalation"
58reference = "https://attack.mitre.org/techniques/T1068/"
59
60
61[rule.threat.tactic]
62id = "TA0004"
63name = "Privilege Escalation"
64reference = "https://attack.mitre.org/tactics/TA0004/"
65
66[rule.threshold]
67field = ["host.hostname"]
68value = 100

References

Related rules

to-top