<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=Security%3A%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB</id>
	<title>Security:哈希长度扩展攻击 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=Security%3A%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB"/>
	<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Security:%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB&amp;action=history"/>
	<updated>2026-06-02T21:26:23Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Security:%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB&amp;diff=1774&amp;oldid=prev</id>
		<title>imported&gt;Soleverlee：​Soleverlee移动页面哈希长度扩展攻击至Security:哈希长度扩展攻击，不留重定向</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Security:%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB&amp;diff=1774&amp;oldid=prev"/>
		<updated>2016-12-20T01:19:15Z</updated>

		<summary type="html">&lt;p&gt;Soleverlee移动页面&lt;a href=&quot;/index.php?title=%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;哈希长度扩展攻击（页面不存在）&quot;&gt;哈希长度扩展攻击&lt;/a&gt;至&lt;a href=&quot;/Security:%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB&quot; title=&quot;Security:哈希长度扩展攻击&quot;&gt;Security:哈希长度扩展攻击&lt;/a&gt;，不留重定向&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2016年12月20日 (二) 01:19的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hans-CN&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>imported&gt;Soleverlee</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Security:%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB&amp;diff=1773&amp;oldid=prev</id>
		<title>2016年9月4日 (日) 02:35 imported&gt;Soleverlee</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Security:%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB&amp;diff=1773&amp;oldid=prev"/>
		<updated>2016-09-04T02:35:06Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2016年9月4日 (日) 02:35的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l45&quot;&gt;第45行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第45行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*https://github.com/soleverlee/hash_extender&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*https://github.com/soleverlee/hash_extender&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*http://www.freebuf.com/articles/web/69264.html&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*http://www.freebuf.com/articles/web/69264.html&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;*http://netifera.com/research/flickr_api_signature_forgery.pdf&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Programe]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Programe]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Soleverlee</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Security:%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB&amp;diff=1772&amp;oldid=prev</id>
		<title>imported&gt;Soleverlee：​以“典型的hash算法，hash = md5((secret + data))，在服务器会校验hash的值。在不知道secret的情况下，如果知道secret的长度，可以算出一...”为内容创建页面</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Security:%E5%93%88%E5%B8%8C%E9%95%BF%E5%BA%A6%E6%89%A9%E5%B1%95%E6%94%BB%E5%87%BB&amp;diff=1772&amp;oldid=prev"/>
		<updated>2016-09-04T02:25:47Z</updated>

		<summary type="html">&lt;p&gt;以“典型的hash算法，hash = md5((secret + data))，在服务器会校验hash的值。在不知道secret的情况下，如果知道secret的长度，可以算出一...”为内容创建页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;典型的hash算法，hash = md5((secret + data))，在服务器会校验hash的值。在不知道secret的情况下，如果知道secret的长度，可以算出一个吻合的hash值。举例如下：&lt;br /&gt;
*服务器的secret = &amp;quot;secret&amp;quot;， 加密算法为md5((secret + data))&lt;br /&gt;
*服务器算好后，把data和hash值一起给客户端&lt;br /&gt;
*服务器接收到请求后，通过再次计算比对，如果匹配证明是合法的请求&lt;br /&gt;
&lt;br /&gt;
比如data = &amp;quot;data&amp;quot;，正常情况下，可以算出一对值：&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
secret = &amp;quot;akSK06mn91c2MxARSrOBTqdmhVCMkkoZ&amp;quot;&lt;br /&gt;
data = &amp;quot;riguz&amp;quot;&lt;br /&gt;
token = secret + data = &amp;quot;akSK06mn91c2MxARSrOBTqdmhVCMkkoZriguz&amp;quot;;&lt;br /&gt;
md5 = md5(token) = &amp;quot;38a67feac3cf91cf3e68467ae803a21b&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
现在，利用[https://github.com/soleverlee/hash_extender hash_extender]可以计算出一对值：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./hash_extender --data riguz --secret 32 --append helloworld --signature 38a67feac3cf91cf3e68467ae803a21b --out-data-format html --table&lt;br /&gt;
md4       dd0c44d807b1c3ca0365b1e656fd1d39 riguz%80%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%28%01%00%00%00%00%00%00helloworld&lt;br /&gt;
md5       1800bc243a00db801833b6e48c1b74ef riguz%80%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%28%01%00%00%00%00%00%00helloworld&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
其中%80%00这种是URL编码后的字符串，即0x80,。假设服务端收到这个字符串，会进行匹配，我们用java代码模拟一下：&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
String test = &amp;quot;akSK06mn91c2MxARSrOBTqdmhVCMkkoZriguz%80%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%28%01%00%00%00%00%00%00helloworld&amp;quot;;&lt;br /&gt;
        try {&lt;br /&gt;
            String t = URLDecoder.decode(test, &amp;quot;ISO-8859-1&amp;quot;);&lt;br /&gt;
            String hex = Hex.hexViewer(t.getBytes(&amp;quot;ISO-8859-1&amp;quot;));&lt;br /&gt;
            System.out.println(hex);&lt;br /&gt;
            String md5 = Hashs.encrypt(&amp;quot;MD5&amp;quot;, t.getBytes(&amp;quot;ISO-8859-1&amp;quot;));&lt;br /&gt;
            System.out.println(&amp;quot;MD5:&amp;quot; + md5);&lt;br /&gt;
        } catch (UnsupportedEncodingException e) {&lt;br /&gt;
            e.printStackTrace();&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
输出为:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Address /  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f Dump&lt;br /&gt;
00000000| 61 6b 53 4b 30 36 6d 6e 39 31 63 32 4d 78 41 52 akSK06mn91c2MxAR&lt;br /&gt;
00000010| 53 72 4f 42 54 71 64 6d 68 56 43 4d 6b 6b 6f 5a SrOBTqdmhVCMkkoZ&lt;br /&gt;
00000020| 72 69 67 75 7a 80 00 00 00 00 00 00 00 00 00 00 riguz&lt;br /&gt;
00000030| 00 00 00 00 00 00 00 00 28 01 00 00 00 00 00 00 &lt;br /&gt;
00000040| 68 65 6c 6c 6f 77 6f 72 6c 64  _  _  _  _  _  _ helloworld&lt;br /&gt;
&lt;br /&gt;
MD5:1800bc243a00db801833b6e48c1b74ef&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
可以看出算出的md5值与hash_extender生成的md5值是匹配的，如果服务器做比对的话，就会认为这个值是合理的。&lt;br /&gt;
Refer:&lt;br /&gt;
*https://github.com/soleverlee/hash_extender&lt;br /&gt;
*http://www.freebuf.com/articles/web/69264.html&lt;br /&gt;
&lt;br /&gt;
[[Category:Programe]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Soleverlee</name></author>
	</entry>
</feed>