<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rs-485.com/index.php?action=history&amp;feed=atom&amp;title=Content_sniffing</id>
	<title>Content sniffing - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rs-485.com/index.php?action=history&amp;feed=atom&amp;title=Content_sniffing"/>
	<link rel="alternate" type="text/html" href="https://rs-485.com/index.php?title=Content_sniffing&amp;action=history"/>
	<updated>2026-05-04T14:43:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://rs-485.com/index.php?title=Content_sniffing&amp;diff=2360&amp;oldid=prev</id>
		<title>Admin: Imported missing template from Wikipedia</title>
		<link rel="alternate" type="text/html" href="https://rs-485.com/index.php?title=Content_sniffing&amp;diff=2360&amp;oldid=prev"/>
		<updated>2026-05-03T17:09:45Z</updated>

		<summary type="html">&lt;p&gt;Imported missing template from Wikipedia&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Practice of deducing the file type of a bitstream}}&lt;br /&gt;
{{More citations needed|date=January 2024}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Content sniffing&amp;#039;&amp;#039;&amp;#039;, also known as &amp;#039;&amp;#039;&amp;#039;media type sniffing&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;MIME sniffing&amp;#039;&amp;#039;&amp;#039;, is the practice of inspecting the content of a [[byte stream]] to attempt to deduce the [[file format]] of the data within it. Content sniffing is generally used to compensate for a lack of accurate [[metadata]] that would otherwise be required to enable the file to be interpreted correctly. Content sniffing techniques tend to use a mixture of techniques that rely on the [[redundancy (information theory)|redundancy]] found in most file formats: looking for [[file format#Magic number|file signature]]s and [[magic number (programming)|magic number]]s, and [[heuristic]]s including searching for well-known representative substrings, the use of [[letter frequency|byte frequency]] and [[n-gram|&amp;#039;&amp;#039;n&amp;#039;&amp;#039;-gram]] tables, and [[Bayesian inference]].&lt;br /&gt;
&lt;br /&gt;
[[Multipurpose Internet Mail Extensions]] (MIME) sniffing was, and still is, used by some [[web browser]]s, including notably [[Microsoft]]&amp;#039;s [[Internet Explorer]], in an attempt to help web sites which do not correctly signal the [[MIME type]] of web content display.&amp;lt;ref&amp;gt;{{cite web|url=http://msdn.microsoft.com/en-us/library/ms775147.aspx|title=MIME Type Detection in Windows Internet Explorer|publisher=Microsoft|access-date=2012-07-14}}&amp;lt;/ref&amp;gt; However, doing this opens up a serious [[security vulnerability]],&amp;lt;ref&amp;gt;{{Cite web|url = http://www.adambarth.com/papers/2009/barth-caballero-song.pdf|title = Secure Content Sniffing for Web Browsers, or How to Stop Papers from Reviewing Themselves|last = Barth|first = Adam|doi = |pmid = |access-date = }}&amp;lt;/ref&amp;gt; in which, by confusing the MIME sniffing algorithm, the browser can be manipulated into interpreting data in a way that allows an attacker to carry out operations that are not expected by either the site operator or user, such as [[cross-site scripting]].&amp;lt;ref&amp;gt;{{cite web|url=http://www.h-online.com/security/features/Risky-MIME-sniffing-in-Internet-Explorer-746229.html|title=Risky sniffing: MIME sniffing in Internet Explorer enables cross-site scripting attacks|author=Henry Sudhof|publisher=The H|date=11 February 2009|access-date=2012-07-14}}&amp;lt;/ref&amp;gt; Moreover, by making sites which do not correctly assign MIME types to content appear to work correctly in those browsers, it fails to encourage the correct labeling of material, which in turn makes content sniffing necessary for these sites to work, creating a vicious circle of incompatibility with web standards and security best practices.&lt;br /&gt;
&lt;br /&gt;
A specification exists for media type sniffing in [[HTML5]], which attempts to balance the requirements of security with the need for reverse compatibility with web content with missing or incorrect MIME-type data. It attempts to provide a precise specification that can be used across implementations to implement a single well-defined and deterministic set of behaviors.&amp;lt;ref&amp;gt;{{cite web|url=http://mimesniff.spec.whatwg.org/|title=Mime Sniffing|author=Adam Barth, Ian Hickson|publisher=WHATWG|access-date=2012-07-14}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UNIX [[file (command)|{{mono|file}} command]] can be viewed as a content sniffing application.&lt;br /&gt;
&lt;br /&gt;
== Charset sniffing ==&lt;br /&gt;
&lt;br /&gt;
{{see also|Charset detection}}&lt;br /&gt;
Numerous web browsers use a more limited form of content sniffing to attempt to determine the [[character encoding]] of text files for which the MIME type is already known. This technique is known as charset sniffing or [[codepage]] sniffing and, for certain encodings, may be used to bypass security restrictions too. For instance, [[Internet Explorer 7]] may be tricked to run [[JScript]] in circumvention of its policy by allowing the browser to guess that an [[HTML]]-file was encoded in [[UTF-7]].&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
|url=http://msdn.microsoft.com/en-us/library/dd565635%28v=vs.85%29.aspx&lt;br /&gt;
|title=Event 1058 - Codepage Sniffing&lt;br /&gt;
|work=Internet Explorer&lt;br /&gt;
|publisher=[[MSDN]]&lt;br /&gt;
|access-date=2012-07-14&lt;br /&gt;
}}&amp;lt;/ref&amp;gt; This bug is worsened by the feature of the UTF-7 encoding which permits multiple encodings of the same text and, specifically, alternative representations of [[ASCII]] characters.&lt;br /&gt;
&lt;br /&gt;
Most encodings do not allow evasive presentations of ASCII characters, so charset sniffing is less dangerous in general because, due to the historical accident of the ASCII-centric nature of scripting and markup languages, characters outside the ASCII repertoire are more difficult to use to circumvent security boundaries, and misinterpretations of character sets tend to produce results no worse than the display of [[mojibake]].&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[[Browser sniffing]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options X-Content-Type-Options header]&lt;br /&gt;
* [https://mimesniff.spec.whatwg.org/ MIME Sniffing Standard]&lt;br /&gt;
* {{cite web|url=http://tools.ietf.org/html/draft-masinter-mime-web-info-00 |date=March 27, 2011 |author=L. Masinter |title=Internet Media Types and the Web |publisher=[[IETF]] |access-date=2012-07-14}}&lt;br /&gt;
* {{cite web|url=http://tools.ietf.org/html/draft-abarth-mime-sniff-06 |date=January 24, 2011 |author=A. Barth, I. Hickson |title=Media Type Sniffing |publisher=[[IETF]] |access-date=2012-07-14}}&lt;br /&gt;
* {{cite web|url=http://deletethis.net/dave/?q=mime-sniffing|title=Mime-sniffing|author=David Risney|access-date=2012-07-14}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Heuristics]]&lt;br /&gt;
[[Category:Computer file formats|*]]&lt;br /&gt;
[[Category:Web technology]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>