{
  "slug": "content-sniffing",
  "term": "Content sniffing",
  "aliases": [
    "MIME sniffing",
    "MIME type sniffing"
  ],
  "definition": "Content sniffing is the process of using resource bytes and contextual metadata to determine a media type for processing.",
  "note": "Supplied versus computed: WHATWG distinguishes a supplied MIME type from the type computed for a resource. Sniffing rules depend on context, such as image loading versus browsing. The result selects an interpretation; it is not a full format-validation or integrity check. [whatwg-sniffing]\n\nHistorical evidence: Barth, Caballero and Song analyzed four browser implementations and compared their sniffers with upload filters. Their IEEE S&P 2009 paper identified interpretation disagreements and proposed avoiding privilege escalation and using prefix-disjoint signatures. Those findings concern historical implementations, not a measured vulnerability in current browsers. [sniffing-2009]\n\nStorage consequence: Preserving identical object bytes does not preserve the HTTP processing contract when delivery metadata changes. Record and verify Content-Type separately from the checksum. RFC 9110 identifies Content-Type as a singleton; a comma-joined pair of types is not a valid list-valued alternative. [http-content-type]\n\nScope: Neither a filename extension nor a matched prefix proves the entire object is well formed. Correct type metadata, integrity verification and validation of the selected format answer different questions. Do not use a successful type guess as an archive-restore acceptance test. [http-content-type]",
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-23",
  "related": [
    "media-type",
    "file-signature",
    "object-storage"
  ],
  "citations": [
    {
      "id": "whatwg-sniffing",
      "title": "WHATWG MIME Sniffing: resource metadata, computed types and context-specific sniffing",
      "url": "https://mimesniff.spec.whatwg.org/",
      "accessed": "2026-11-23"
    },
    {
      "id": "sniffing-2009",
      "title": "Barth, Caballero and Song (IEEE S&P 2009): Secure Content Sniffing for Web Browsers, sections 2-3",
      "url": "https://bitblaze.cs.berkeley.edu/papers/mimesniff_oakland09.pdf",
      "accessed": "2026-11-23"
    },
    {
      "id": "http-content-type",
      "title": "RFC 9110, section 8.3: Content-Type",
      "url": "https://www.rfc-editor.org/rfc/rfc9110.html#section-8.3",
      "accessed": "2026-11-23"
    },
    {
      "id": "hesela-context",
      "title": "Hesela: identify the format, then validate the file",
      "url": "https://hesela.com/analyses/object-etags-checksums-conditional-writes/#format-identification",
      "accessed": "2026-11-23"
    }
  ],
  "provenance": [
    "Primary-source synthesis of HTTP semantics, the WHATWG processing model and historical browser research; no new browser-security experiment or fleet measurement."
  ]
}
