Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› RFC 2231 Filename Star Precedence
Cyber Security

RFC 2231 Filename Star Precedence

← Back to Glossary
By NHI Mgmt Group Updated November 25, 2026 Domain: Cyber Security

RFC 2231 Filename Star Precedence is the rule for choosing a filename parameter that uses the extended filename* syntax over a plain filename parameter in MIME headers. It applies when email or HTTP content includes both forms, so parsers can decode the encoded value consistently and avoid attachment handling ambiguity.

Filename parameter precedence in MIME parsing

RFC 2231 filename star precedence matters because parsers often receive both a plain filename parameter and an extended filename* parameter for the same attachment. The precedence rule tells software which value to trust, so the decoded name is handled consistently instead of depending on parser quirks or header order.

This is not just a formatting detail. MIME headers cross email, web, and API boundaries, and inconsistent interpretation can create ambiguity in how a file is displayed, stored, scanned, or routed. The core security value is deterministic parsing, especially when the filename influences downstream handling.

How RFC 2231 encoding changes filename handling

The extended filename* form exists so non-ASCII text, percent-encoded bytes, and language information can be represented more reliably than in a plain token. In practice, that means the parser must decode the extended value before comparing it with the unextended parameter and before deciding which label to present to users or systems.

When both forms appear, the precedence rule resolves a semantic conflict. Without that rule, one component may treat the plain value as authoritative while another prefers the encoded value, which can lead to mismatched metadata across mail clients, gateways, proxies, and archive systems.

Why precedence matters for interoperability and trust

The main purpose of the rule is interoperability, but the security consequence is trust in metadata. A filename is often used for user display, download naming, logging, quarantine decisions, and analyst review, so ambiguity can affect both human judgement and automated policy.

When different parsers disagree, an attachment can appear under one name in transit and another name after decoding. That inconsistency can confuse users, complicate forensic review, and undermine controls that depend on the filename being stable and predictable.

Common parsing mistakes and implementation pitfalls

Implementations go wrong when they compare raw header text instead of normalised values, merge parameters without a clear precedence order, or accept whichever form appears last. Another common mistake is treating the extended value as a fallback only when the plain value is absent, even when the specification says the star form should win in the relevant conflict case.

Robust parsers should normalise the header first, decode the extended value correctly, and then apply a single precedence rule across all supported transport paths. If a product handles attachments, content-disposition headers, or MIME metadata, filename precedence needs to be tested as part of parser hardening.

Risk and Threat Considerations

Ambiguous filename parsing can be abused to hide the real attachment name, create inconsistent scanning results, or desynchronise what the gateway sees from what the user sees. The risk is greatest where filename metadata influences trust decisions, user prompts, or file-type handling.

Failure mechanism: A malicious sender can supply both parameters so one component interprets the plain name and another interprets the encoded name, producing a split view of the same attachment.

Impact: This can support spoofing, policy bypass, mislabelled quarantines, misleading audit records, and analyst confusion during incident review.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5, OWASP ASVS and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5SI-10 — Information Input ValidationMIME filename precedence depends on disciplined parsing of untrusted header input.
AU-3 — Content of Audit RecordsConsistent filename resolution affects the fidelity of logs and forensic records.
Recommendation — Validate and normalize MIME parameters before any filename-dependent handling. Record the resolved filename and source header details in audit events.
OWASP ASVSV4 — API and Web ServiceMultipart and header parsing rules matter when web services accept file uploads.
Recommendation — Verify consistent handling of multipart filename parameters and encoded metadata.
CIS Controls v8CIS-16 — Application Software SecurityParser edge cases in attachment handling belong in secure software testing and validation.
Recommendation — Test attachment-handling code for conflicting MIME filename encodings.

Practitioner Guidance

Why practitioners should care: Treat filename precedence as a parser correctness issue, not a cosmetic one. If your product consumes MIME messages or HTTP multipart content, this rule should be covered by conformance tests, negative tests, and regression cases for conflicting parameters.

What to watch for: Check whether your implementation normalises and decodes the extended parameter before selection, and whether every downstream component sees the same resolved filename. Where behaviour differs between libraries or language runtimes, document the chosen precedence and enforce it consistently.

Practitioner takeaway: The safest design is one resolved filename, one precedence rule, and one interpretation path from ingress to logging.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org