Remote code execution via SPF macro overflow
Published Aug 12, 2021 · Updated Feb 13, 2025
Stack buffer overflow in LibSPF2 before 1.2.11 allows remote attackers to execute code or crash mail services via crafted SPF records. SPF_record_compile_macro initializes ds_avail without subtracting the four-byte SPF_data header, so a long explanation macro overwrites four bytes beyond the stack buffer. Exploitation requires a mail server using the library to process SPF for an attacker-controlled domain; the demonstrated result is process termination, while code execution is also reported.
Summary
What happened
Stack buffer overflow in LibSPF2 before 1.2.11 allows remote attackers to execute code or crash mail services via crafted SPF records. SPF_record_compile_macro initializes ds_avail without subtracting the four-byte SPF_data header, so a long explanation macro overwrites four bytes beyond the stack buffer. Exploitation requires a mail server using the library to process SPF for an attacker-controlled domain; the demonstrated result is process termination, while code execution is also reported.
The record
- CVE
- CVE-2021-20314
- Published
- Aug 12, 2021
- Updated
- Feb 13, 2025
- Vendor
- LibSPF2 Project
- Product
- LibSPF2
- Classifications
- CWE-787, T1190
- Attack vector
- network
- Privileges
- unauthenticated
Timeline
How it unfolded
- Aug 12, 2021CVE publishedPublication date reported by the CVE source.
- Feb 13, 2025Record updatedLatest update available in the CVE record.
Exploitability
Present is not the same as exploitable
Compare your product and version with the public record. A matching version still requires validation against your environment.
Is a vulnerable build present?
Compare these published version ranges with your installed build and any vendor patches.
- Affected versionversion=1.2.11
What conditions does exploitation require?
What is affected?
Attacks
What attackers are doing with it
Daily unique IPs observed by Shadowserver honeypots for known exploited vulnerabilities (KEVs). Missing observations do not establish an absence of attacks.
Public exploit references
- SPF explanation macro crash reproductionproof of concept · demonstrated
Labels summarize the accepted research assessment. They do not indicate a test against your environment.
Technologies
Your stack
See the directory against your own environment.
Your stack
Check the software in your environment
Book a demo to see how Hinoki identifies affected software and validates exploitability in your environment.
Book a demo