{"id":513,"date":"2014-04-10T07:26:03","date_gmt":"2014-04-10T07:26:03","guid":{"rendered":"http:\/\/www.selinuxplus.com\/?p=513"},"modified":"2014-04-10T07:32:58","modified_gmt":"2014-04-10T07:32:58","slug":"openssl-heartbeat%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/www.selinuxplus.com\/?p=513","title":{"rendered":"openssl heartbeat\u95ee\u9898"},"content":{"rendered":"<p>openssl \u5b98\u65b9\u7f51\u7ad94\u67087\u65e5\u7684\u516c\u5e03\uff1a\u6709\u7814\u7a76\u4eba\u5458\u53d1\u73b0OpenSSL 1.0.1\u548c1.0.2-beta\u7248\u672c\u4e2d\u5b58\u5728\u5b89\u5168\u6f0f\u6d1e\uff08\u7f16\u53f7\u4e3aCVE-2014-0160\uff09\uff0c\u53ef\u80fd\u66b4\u9732\u5bc6\u94a5\u548c\u79c1\u5bc6\u901a\u4fe1\uff0c\u5e94\u8be5\u5c3d\u5feb\u4fee\u8865\uff0c\u65b9\u6cd5\u662f\uff1a<\/p>\n<p>\u5347\u7ea7\u5230\u6700\u65b0\u7248\u672cOpenSSL 1.0.1g<br \/>\n\u65e0\u6cd5\u7acb\u5373\u5347\u7ea7\u7684\u7528\u6237\u53ef\u4ee5\u4ee5-DOPENSSL_NO_HEARTBEATS\u5f00\u5173\u91cd\u65b0\u7f16\u8bd1OpenSSL<br \/>\n1.0.2-beta\u7248\u672c\u7684\u6f0f\u6d1e\u5c06\u5728beta2\u7248\u672c\u4fee\u590d<br \/>\n\u66f4\u8001\u7248\u672c\u7684OpenSSL\uff081.0.0\u548c0.9.8\u7b49\uff09\u53cd\u800c\u4e0d\u53d7\u5f71\u54cd<\/p>\n<pre class=\"lang:default decode:true \" >site:https:\/\/www.openssl.org\/news\/secadv_20140407.txt<\/pre>\n<p>\u8fd9\u4e2a\u6f0f\u6d1e\u662f\u7531\u5b89\u5168\u516c\u53f8Codenomicon\u7684\u7814\u7a76\u4eba\u5458\u548cGoogle\u5b89\u5168\u5c0f\u7ec4\u7684Neel Mehta\u76f8\u4e92\u72ec\u7acb\u5730\u53d1\u73b0\u7684\u3002\u6f0f\u6d1e\u51fa\u5728OpenSSL\u5bf9TLS\u7684\u5fc3\u8df3\u6269\u5c55\uff08RFC6520\uff09\u7684\u5b9e\u73b0\u4ee3\u7801\u4e2d\uff0c\u7531\u4e8e\u6f0f\u4e86\u4e00\u5904\u8fb9\u754c\u68c0\u67e5\uff0c\u800c\u53ef\u80fd\u5728\u6bcf\u6b21\u5fc3\u8df3\u4e2d\u66b4\u9732\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u901a\u4fe1\u4e2d\u768464K\u5185\u5b58\uff0c\u8fd9\u5e76\u4e0d\u662f\u8bbe\u8ba1\u9519\u8bef\u3002<\/p>\n<p>Hacker News\u7f51\u53cbdrv\u5728\u9605\u8bfb\u4e86\u6f0f\u6d1e\u4ee3\u7801\u540e\u6307\u51fa\uff0c\u8fd9\u662f\u4e00\u4e2a\u4f4e\u7ea7\u9519\u8bef\u3002\u4ed6\u89e3\u91ca\u8bf4\uff1a<\/p>\n<p>TLS\u5fc3\u8df3\u7531\u4e00\u4e2a\u8bf7\u6c42\u5305\u7ec4\u6210\uff0c\u5176\u4e2d\u5305\u62ec\u6709\u6548\u8f7d\u8377\uff08payload\uff09\uff0c\u901a\u4fe1\u7684\u53e6\u4e00\u65b9\u5c06\u8bfb\u53d6\u8fd9\u4e2a\u5305\u5e76\u53d1\u9001\u4e00\u4e2a\u54cd\u5e94\uff0c\u5176\u4e2d\u5305\u542b\u540c\u6837\u7684\u8f7d\u8377\u3002\u5728\u5904\u7406\u5fc3\u8df3\u8bf7\u6c42\u7684\u4ee3\u7801\u4e2d\uff0c\u8f7d\u8377\u5927\u5c0f\u662f\u4ece\u653b\u51fb\u8005\u53ef\u80fd\u63a7\u5236\u7684\u5305\u4e2d\u8bfb\u53d6\u7684\uff1a<br \/>\nopenssl\u7684\u6f0f\u6d1e\u7684\u4fee\u590d\u5730\u5740 <\/p>\n<pre class=\"lang:default decode:true \" >http:\/\/git.openssl.org\/gitweb\/?p=openssl.git;a=commitdiff;h=96db9023b881d7cd9f379b0c154650d6c108e9a3<\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u6f0f\u6d1e\u4ecessl\/d1_both.c:\u5f00\u59cb\u4fee\u590d<\/p>\n<pre class=\"lang:default decode:true \" >int dtls1_process_heartbeat(SSL *s)\r\n    {          \r\n    unsigned char *p = &amp;s-&gt;s3-&gt;rrec.data[0], *pl;\r\n    unsigned short hbtype;\r\n    unsigned int payload;\r\n    unsigned int padding = 16; \/* Use minimum padding *\/<\/pre>\n<p>\u8fd9\u662f\u4e00\u6761\u6307\u5411SSLv3\u8bb0\u5f55\u4e2d\u7684\u6570\u636e\u7684\u6307\u9488\uff0c\u7ed3\u6784\u4f53SSL3_RECORD\u7684\u5b9a\u4e49\u5982\u4e0b\uff1a<br \/>\n\u7ed3\u6784\u4f53SSL3_RECORD\u4e0d\u662fSSLv3\u8bb0\u5f55\u7684\u5b9e\u9645\u5b58\u50a8\u683c\u5f0f\u3002\u4e00\u6761SSLv3\u8bb0\u5f55\u6240\u9075\u5faa\u7684\u5b58\u50a8\u683c\u5f0f\u5982\u4e0b<\/p>\n<pre class=\"lang:default decode:true \" >typedef struct ssl3_record_st\r\n    {\r\n        int type;               \/* type of record *\/\r\n        unsigned int length;    \/* How many bytes available *\/\r\n        unsigned int off;       \/* read\/write offset into 'buf' *\/\r\n        unsigned char *data;    \/* pointer to the record data *\/\r\n        unsigned char *input;   \/* where the decode bytes are *\/\r\n        unsigned char *comp;    \/* only used with decompression - malloc()ed *\/\r\n        unsigned long epoch;    \/* epoch number, needed by DTLS1 *\/\r\n        unsigned char seq_num[8]; \/* sequence number, needed by DTLS1 *\/\r\n    } SSL3_RECORD;<\/pre>\n<p>\u6bcf\u6761SSLv3\u7684\u8bb0\u5f55\u7531type\uff08\u7c7b\u578b\uff09,length\u548cpointer to the record data(\u6307\u5411\u8bb0\u5f55\u6570\u636e\u7684\u6307\u9488)*data.<\/p>\n<pre class=\"lang:default decode:true \" >\/* Read type and payload length first *\/\r\nhbtype = *p++;\r\nn2s(p, payload);\r\npl = p;<\/pre>\n<p>SSLv3\u8bb0\u5f55\u7684\u7b2c\u4e00\u4e2a\u5b57\u8282\u8868\u660e\u4e86\u5fc3\u8df3\u5305\u7684\u7c7b\u578b\uff0cn2s\u4ece\u6307\u9488p\u6307\u5411\u7684\u6570\u7ec4\u4e2d\u63d0\u53d6\u524d2\u4e2a\u5b57\u8282\uff0c\u5e76\u628a\u5b83\u4fdd\u5b58\u5728payload\u53d8\u91cf\u4e2d\uff0c\u5b9e\u9645\u4e0a\u662f\u5fc3\u8df3\u5305\u8f7d\u8377\u7684\u957f\u5ea6length.\u8fd9\u91cc\u6ca1\u6709\u68c0\u67e5SSLv3\u7684\u5b9e\u9645\u957f\u5ea6\u3002\u53d8\u91cfpl\u5219\u662f\u6307\u5411\u8bbf\u95ee\u8005\u5b9e\u9645\u63d0\u4f9b\u7684\u5fc3\u8df3\u5305\u6570\u636e\u3002<br \/>\n\u63a5\u7740\uff1a<\/p>\n<pre class=\"lang:default decode:true \" >unsigned char *buffer, *bp;\r\nint r;\r\n \r\n\/* Allocate memory for the response, size is 1 byte\r\n * message type, plus 2 bytes payload length, plus\r\n * payload, plus padding\r\n *\/\r\nbuffer = OPENSSL_malloc(1 + 2 + payload + padding);\r\nbp = buffer;<\/pre>\n<p>\u8fd9\u6bb5\u7a0b\u5e8f\u5206\u914d\u4e00\u6bb5\u6709\u8bbf\u95ee\u8005\u6307\u5b9a\u5927\u5c0f\u7684\u5185\u5b58\u533a\u57df\uff0c\u8fd9\u6bb5\u5185\u5b58\u533a\u57df\u6700\u5927\u4e3a65535+1+2+16\u4e2a\u5b57\u8282((2^16)-1,65535)<br \/>\n\u53d8\u91cfbp\u5219\u6307\u5411\u4e86\u8fd9\u6bb5\u5185\u5b58\u533a\u57df\u3002<br \/>\n\u7136\u540e\u54cd\u5e94\u5305\u662f\u8fd9\u6837\u6784\u9020\u7684\uff1a<\/p>\n<pre class=\"lang:default decode:true \" >\/* Enter response type, length and copy payload *\/\r\n*bp++ = TLS1_HB_RESPONSE;\r\ns2n(payload, bp);\r\nmemcpy(bp, pl, payload);<\/pre>\n<p>s2n\u4e0en2s\u7684\u529f\u80fd\u76f8\u53cd\uff0cs2n\u8bfb\u5165\u4e00\u4e2a16bit\u7684\u503c\uff0c\u7136\u540e\u5c06\u5b83\u5b58\u6210\u53cc\u5b57\u8282\u503c\uff0cs2n\u4f1a\u5c06\u4e0e\u8bf7\u6c42\u7684\u5fc3\u8df3\u5305\u8f7d\u8377\u957f\u5ea6\u76f8\u540c\u7684\u503c\u5b58\u5165\u53d8\u91cfpayload\u3002\u7136\u540e\u7a0b\u5e8f\u4ecepl\u5904\u5f00\u59cb\u590d\u5236payload\u4e2a\u5b57\u8282\u5230\u65b0\u5206\u914dbp\u6570\u7ec4\u4e2d\uff0cpl\u6307\u5411\u4e86\u7528\u6237\u63d0\u4f9b\u7684\u5fc3\u8df3\u5305\u6570\u636e\uff0c\u7136\u540e\uff0c\u6668\u66e6\u5c06\u6240\u4ee5\u7684\u6570\u636e\u53d1\u56de\u7ed9\u7528\u6237\u3002<\/p>\n<p>\u8fd9\u6837\u4e00\u6765\uff0c\u7528\u6237\u53ef\u4ee5\u63a7\u5236\u53d8\u91cfpayload\uff0c\u4ee5\u8fbe\u5230\u63a7\u5236pl\u3002<br \/>\n\u5982\u679c\u7528\u6237\u5e76\u6ca1\u6709\u5728\u5fc3\u8df3\u5305\u4e2d\u63d0\u4f9b\u8db3\u591f\u591a\u7684\u6570\u636e\uff0c\u4f1a\u5bfc\u81f4\u4ec0\u4e48\u95ee\u9898\u5462\u3002\u5982\u679cpl\u6307\u5411\u7684\u6570\u636e\u5b9e\u9645\u957f\u5ea6\u53ea\u6709\u4e00\u4e2a\u5b57\u8282\uff0c\u90a3\u4e48memcpy\u4f1a\u628a\u8fd9\u6761SSLv3\u8bb0\u5f55\u4e4b\u540e\u7684\u6570\u636e\uff0c\u65e0\u8bba\u8fd9\u4e9b\u6570\u636e\u662f\u4ec0\u4e48\uff0c\u90fd\u4f1a\u88ab\u590d\u5236\u51fa\u6765\u3002<br \/>\n\u5f88\u660e\u663e\uff0cSSLv3\u8bb0\u5f55\u9644\u8fd1\u6709\u4e0d\u5c11\u4e1c\u897f\u7684\u3002<br \/>\n\u5f53\u7136\uff0c\u4f60\u4e5f\u6ca1\u529e\u6cd5\u8bfb\u53d6\u5176\u5b83\u8fdb\u7a0b\u7684\u6570\u636e\uff0c\u6240\u4ee5\u201c\u91cd\u8981\u7684\u5546\u4e1a\u6587\u6863\u201d\u5fc5\u987b\u4f4d\u4e8e\u5f53\u524d\u8fdb\u7a0b\u7684\u5185\u5b58\u533a\u57df\u4e2d\u3001\u5c0f\u4e8e64KB\uff0c\u5e76\u4e14\u521a\u597d\u4f4d\u4e8e\u6307\u9488pl\u6307\u5411\u7684\u5185\u5b58\u5757\u9644\u8fd1<br \/>\n\u4fee\u590d\u4ee3\u7801\u4e2d\u6700\u91cd\u8981\u7684\u4e00\u90e8\u5206\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:default decode:true \" >\/* Read type and payload length first *\/\r\nif (1 + 2 + 16 &gt; s-&gt;s3-&gt;rrec.length)\r\n    return 0; \/* silently discard *\/\r\nhbtype = *p++;\r\nn2s(p, payload);\r\nif (1 + 2 + payload + 16 &gt; s-&gt;s3-&gt;rrec.length)\r\n    return 0; \/* silently discard per RFC 6520 sec. 4 *\/\r\npl = p;<\/pre>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5e72\u4e86\u4e24\u4ef6\u4e8b\u60c5\uff1a\u9996\u5148\u7b2c\u4e00\u884c\u8bed\u53e5\u629b\u5f03\u4e86\u957f\u5ea6\u4e3a0\u7684\u5fc3\u8df3\u5305\uff0c\u7136\u540e\u7b2c\u4e8c\u6b65\u68c0\u67e5\u786e\u4fdd\u4e86\u5fc3\u8df3\u5305\u8db3\u591f\u957f\u3002\u5c31\u8fd9\u4e48\u7b80\u5355\u3002<br \/>\n\u987a\u4fbf\u4e86\u89e3\u4e00\u4e0b<br \/>\n\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5728\u548cssl\u5efa\u7acbhello\u4e4b\u540e\uff0c\u53d1\u9001\u4e00\u4e2a\u77ed\u5b57\u8282\u7684\u5fc3\u8df3\u3002\u6211\u4eec\u5efa\u7acb\u4e00\u4e2ahello\u7684\u901a\u4fe1<br \/>\n\u5ba2\u6237\u95ee\u5019\u6d88\u606f\uff08client hello\uff09\u7684\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:default decode:true \" > struct { \r\nProtocolVersion client_version; \r\nRandom random; \r\nSessionID session_id; \r\nCipherSuite cipher_suites&lt;2..2^16 -1&gt;; \r\nCompressionMethod compression_methods&lt;1..2^8 -1&gt;; \r\n } ClientHello; <\/pre>\n<p>client_version       \u5ba2\u6237\u7aef\u5e0c\u671b\u5728\u6b64\u6b21\u5bf9\u8bdd\u4e2d\u4f7f\u7528\u7684SSL\u534f\u8bae\u7684\u7248\u672c\u3002\u8fd9\u5e94\u8be5\u662f\u88ab\u5ba2\u6237<br \/>\n                     \u7aef\u6240\u652f\u6301\u7684\u6700\u65b0\u7684\u7248\u672c(\u6700\u9ad8\u503c)\u3002\u5bf9\u4e8e\u672c\u6587\u6240\u63cf\u8ff0\u7684SSL\u534f\u8bae\uff0c\u7248<br \/>\n                     \u672c\u53f7\u5e94\u8be5\u662f3.0\u3002(\u5173\u4e8e\u80cc\u666f\u517c\u5bb9\u4fe1\u606f\u8bf7\u89c1\u9644\u5f55E)\u3002<br \/>\nrandom               \u4e00\u4e2a\u5ba2\u6237\u7aef\u751f\u6210\u7684\u968f\u673a\u7ed3\u6784\u3002<br \/>\nsession_id           \u5ba2\u6237\u7aef\u5728\u6b64\u6b21\u8fde\u63a5\u4e2d\u60f3\u4f7f\u7528\u7684\u5bf9\u8bdd\u6807\u8bc6\u7b26\uff08ID\uff09\u3002\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684<br \/>\n                     session\u2014ID\u6216\u8005\u5ba2\u6237\u7aef\u60f3\u8981\u751f\u6210\u65b0\u7684\u52a0\u5bc6\u53c2\u6570\uff0c\u8fd9\u4e2a\u503c\u5e94\u8be5\u4e3a\u7a7a\u3002<br \/>\ncipher_suites        \u8fd9\u662f\u4e00\u4e2a\u7531\u5ba2\u6237\u7aef\u652f\u6301\u7684,\u7531\u5ba2\u6237\u7aef\u6309\u5176\u81ea\u8eab\u7684\u504f\u7231\u800c\u9009\u5b9a\u7684\u52a0\u5bc6\u5957<br \/>\n                     \u63a5\u5b57\u7684\u5217\u8868(\u5217\u8868\u7684\u7b2c\u4e00\u9879\u662f\u5176\u6700\u559c\u7231\u7684)\uff0c\u5982\u679csession_id \u57df\u975e<br \/>\n                     \u7a7a(\u6697\u793a\u91cd\u65b0\u5f00\u59cb\u4e00\u5df2\u6709\u7684\u5bf9\u8bdd)\uff0c\u5219\u6b64\u5411\u91cf\u5fc5\u987b\u81f3\u5c11\u5305\u542b\u6765\u81ea\u5df2\u6709<br \/>\n                     \u5bf9\u8bdd\u7684cipher_suite\u3002\u52a0\u5bc6\u5957\u63a5\u5b57\u7684\u503c\u7684\u5b9a\u4e49\u89c1\u9644\u5f55A.6\u3002<br \/>\ncompression_methods  \u8fd9\u662f\u4e00\u4e2a\u7531\u5ba2\u6237\u7aef\u652f\u6301\u7684\u538b\u7f29\u7b97\u6cd5\u7684\u5217\u8868\uff0c\u4ed6\u6839\u636e\u5ba2\u6237\u7aef\u81ea\u8eab\u7684\u504f<br \/>\n                     \u7231\u800c\u9009\u5b9a\u7684\uff08\u5217\u8868\u7684\u7b2c\u4e00\u9879\u662f\u5176\u6700\u559c\u7231\u7684)\uff0c\u5982\u679csession_id \u57df\u975e<br \/>\n                     \u7a7a(\u6697\u793a\u91cd\u65b0\u5f00\u59cb\u4e00\u5df2\u6709\u7684\u5bf9\u8bdd)\uff0c\u5219\u6b64\u5411\u91cf\u5fc5\u987b\u81f3\u5c11\u5305\u542b\u4e00\u4e2a\u6765\u81ea<br \/>\n                     \u5df2\u6709\u5bf9\u8bdd\u7684compression_methods\u7684\u53c2\u6570\u3002\u6240\u6709\u5b9e\u73b0\u5747\u5fc5\u987b\u652f\u6301<br \/>\n                     CompressionMethod.null\u3002 <\/p>\n<p>\u7ee7\u53d1\u9001client hello\u6d88\u606f\u4e4b\u540e\uff0c\u5ba2\u6237\u7aef\u7b49\u5019\u4e00\u4e2a\u670d\u52a1\u5668\u95ee\u5019\u6d88\u606f\uff08server hello message\uff09\u3002\u9664\u4e86hello\u6d88\u606f\u5916\uff0c\u7531\u670d\u52a1\u5668\u8fd4\u56de\u7684\u4efb\u4f55\u5176\u4ed6\u63e1\u624b\u6d88\u606f\uff0c\u5747\u88ab\u89c6\u4e3a\u81f4\u547d\u9519\u8bef(fatal error)\u3002<br \/>\n\u53d1\u9001\u7684hello\u6d88\u606f\u5982\u4e0b\uff1a\t<\/p>\n<pre class=\"lang:default decode:true \" >16 03 02 00  dc 01 00 00 d8 03 02 53 \r\n43 5b 90 9d 9b 72 0b bc  0c bc 2b 92 a8 48 97 cf\r\nbd 39 04 cc 16 0a 85 03  90 9f 77 04 33 d4 de 00 \r\n00 66 c0 14 c0 0a c0 22  c0 21 00 39 00 38 00 88\r\n00 87 c0 0f c0 05 00 35  00 84 c0 12 c0 08 c0 1c\r\nc0 1b 00 16 00 13 c0 0d  c0 03 00 0a c0 13 c0 09\r\nc0 1f c0 1e 00 33 00 32  00 9a 00 99 00 45 00 44\r\nc0 0e c0 04 00 2f 00 96  00 41 c0 11 c0 07 c0 0c\r\nc0 02 00 05 00 04 00 15  00 12 00 09 00 14 00 11\r\n00 08 00 06 00 03 00 ff  01 00 00 49 00 0b 00 04\r\n03 00 01 02 00 0a 00 34  00 32 00 0e 00 0d 00 19\r\n00 0b 00 0c 00 18 00 09  00 0a 00 16 00 17 00 08\r\n00 06 00 07 00 14 00 15  00 04 00 05 00 12 00 13\r\n00 01 00 02 00 03 00 0f  00 10 00 11 00 23 00 00\r\n00 0f 00 01 01\r\n<\/pre>\n<p>16 \uff1a\u4ee3\u8868records contains some handshake message data(\u5efa\u7acb\u63e1\u624b\u4fe1\u606f) SSLv3<br \/>\n03 02 \uff1aTLS 1.0\u901a\u5e38\u88ab\u6807\u793a\u4e3aSSL 3.1\uff0cTLS 1.1\u4e3aSSL 3.2\uff0cTLS 1.2\u4e3aSSL 3.3\u3002\u6240\u4ee503 01\u8868\u793aSSL\u4f7f\u7528\u7684\u7248\u672c\uff1aSSL 3.1AKA TLS 1.0\uff0c03 02\u5bf9\u5e94SSL3.2<br \/>\n00  dc\uff1a2 bytes\u957f\u5ea6\uff0c\u4ee3\u8868\u6d88\u606f\u957f\u5ea6<br \/>\n01:\u4ee3\u8868\u8bf7\u6c42client\u8bf7\u6c42<br \/>\n00 00 d8\uff1a\u4ee3\u8868clienthello\u7684\u6d88\u606f\u957f\u5ea6<\/p>\n<p>\u53ef\u4ee5\u7528\u4ee5\u4e0b\u8fd9\u4e2a\u516c\u5f0f\u8868\u793a\uff1a<br \/>\n0x16 0x03 X Y Z 0x01 A B C<br \/>\nX   #\u53ef\u80fd\u662f0,1,2,3<br \/>\nY Z #\u662f\u6d88\u606f\u62a5\u6587\u957f\u5ea6<br \/>\nA B C #\u662f\u5ba2\u6237\u7aefhello\u7684\u6d88\u606f\u957f\u5ea6\u3002\u8fd9\u4e2ahello message\u5f00\u59cb\u4e8e\u4e00\u4e2a4\u4e2a\u5b57\u8282\u7684\u62a5\u5934\uff0c\u4f46\u672a\u5305\u542b\u5728\u8fd9\u4e2a\u957f\u5ea6\u91cc\uff0c\u5e94\u8be5\u662f\u72ec\u81ea\u7684\u8bb0\u5f55\u3002<br \/>\n\u6240\u4ee5\u4f60\u53ef\u4ee5\u5f97\u5230 A = 0\uff1b 256*X+Y = 256*B +C +4 \u4e5f\u5c31\u662fX*2^8 +y<br \/>\n\u4e0a\u9762\u7684\u957f\u5ea6\u5219\u662f00*256+dc =220\uff1b 256*0+d8 + 4 =216+4 =220;\u540e\u9762\u7684\u4fe1\u606f\u5219\u662frandom+session_id+cipher_suites+compression_methods<\/p>\n<pre class=\"lang:default decode:true \" >\r\n+-----+-------------+----------+----------------+----------------+\r\n|\u7248\u672c  |\u968f\u673a\u6570        |\u4f1a\u8bddID    |\u52a0\u5bc6\u5957\u4ef6\u5217\u8868      |\u538b\u7f29\u65b9\u6cd5\u5217\u8868     |\r\n+-----+-------------+----------+----------------+----------------+\r\n|\u4e3b|\u4ece |\u65f6\u95f4|\u968f\u673a\u5b57\u8282 |\u957f\u5ea6(1)|ID|\u957f\u5ea6(2)|\u5957\u4ef6\u5217\u8868  |\u957f\u5ea6(2)  |\u65b9\u6cd5\u5217\u8868|\r\n+-----+-------------+----------+----------------+----------------+<\/pre>\n<p>16 03 02 00  dc  #TLS \u5934\u90e8\u4fe1\u606f<br \/>\n01 00 00 d8  #\u63e1\u624b\u4fe1\u606f<br \/>\n03 02 #[\u5ba2\u6237\u7aefhello\u533a\u57df]\uff1a\u4e3b\uff1a03 \u4ece:02<br \/>\n53 43 5b 90 #[\u5ba2\u6237\u7aefhello\u533a\u57df] \u65f6\u95f44\u5b57\u8282,2014\u5e744\u67088\u65e5 \u4e0a\u534810:14:40<br \/>\n00 #[\u5ba2\u6237\u7aefhello\u533a\u57df] \u4f1a\u8bddID\u957f\u5ea6 0;<br \/>\n00 66 #[\u5ba2\u6237\u7aefhello\u533a\u57df] \u52a0\u5bc6\u5957\u4ef6\u957f\u5ea6102\u5b57\u8282<br \/>\n01 #[\u5ba2\u6237\u7aefhello\u533a\u57df] \u538b\u7f29\u652f\u6301\u957f\u5ea61,length (1)<br \/>\n00 #[\u5ba2\u6237\u7aefhello\u533a\u57df]\u538b\u7f29\u652f\u6301,\u4e0d\u538b\u7f29,no compression (0)<br \/>\n00 49#[\u5ba2\u6237\u7aefhello\u533a\u57df]\u538b\u7f29\u65b9\u6cd5\u5217\u8868\u957f\u5ea6,73\u5b57\u8282<\/p>\n<p>\u540c\u6837\u7684\u5fc3\u8df3\u4fe1\u606f\u5982\u4e0b\uff1a<br \/>\n18 03 02 00 03<br \/>\n01 40 00<br \/>\n18 #\u5fc3\u8df3\u7c7b\u578b<br \/>\n03 02 #TLS\u7248\u672c\u53f7<br \/>\n00 03 #\u5fc3\u8df3\u62a5\u6587\u957f\u5ea6<br \/>\n01 #\u5ba2\u6237\u7aef\u8bf7\u6c42<br \/>\n40 00 #\u4ee3\u8868payload \u957f\u5ea6\uff0c2^14 =16384\uff1b<\/p>\n<p>drv\u8bc4\u8ff0\u8bf4\uff1a<\/p>\n<p>\u5f88\u96be\u76f8\u4fe1OpenSSL\u7684\u4ee3\u7801\u5c45\u7136\u6ca1\u6709\u5bf9\u5b57\u8282\u6d41\u7684\u5904\u7406\u505a\u62bd\u8c61\uff0c\u5982\u679c\u5305\u7528(\u6307\u9488\uff0c\u957f\u5ea6)\u5bf9\u6765\u8868\u793a\uff0c\u7528\u7b80\u5355\u7684\u5c01\u88c5\u51fd\u6570\u590d\u5236\uff0c\u5c31\u80fd\u907f\u514d\u8fd9\u4e2a\u6f0f\u6d1e\u3002\u7528C\u8bed\u8a00\u7684\u65f6\u5019\uff0c\u5199\u8fd9\u79cd\u95ee\u9898\u4ee3\u7801\u592a\u5bb9\u6613\u4e86\uff0c\u4f46API\u8bbe\u8ba1\u4ed4\u7ec6\u4e00\u70b9\uff0c\u5c31\u4f1a\u5927\u5927\u589e\u52a0\u72af\u9519\u7684\u96be\u5ea6\u3002<\/p>\n<p>\u53d7\u5f71\u54cd\u7684\u7248\u672c\u4e3b\u8981\u6709\uff1a<br \/>\nOpenSSL 1.0.1f \uff08\u53d7\u5f71\u54cd\uff09<br \/>\nOpenSSL 1.0.2-beta \uff08\u53d7\u5f71\u54cd\uff09<br \/>\nOpenSSL 1.0.1g \uff08\u4e0d\u53d7\u5f71\u54cd\uff09<br \/>\nOpenSSL 1.0.0 branch \uff08\u4e0d\u53d7\u5f71\u54cd\uff09<br \/>\nOpenSSL 0.9.8 branch \uff08\u4e0d\u53d7\u5f71\u54cd\uff09<\/p>\n<p>\u5efa\u8bae\u8fdb\u884c\u7248\u672c\u66f4\u65b0\uff0c\u66f4\u65b0\u540e\u91cd\u542f\u670d\u52a1\uff0c\u901a\u8fc7lsof -n | grep ssl | grep DEL\u5217\u51fa\u9700\u8981\u91cd\u65b0\u542f\u52a8\u670d\u52a1\uff0c\u7136\u540e\u5c06\u5217\u51fa\u7684\u670d\u52a1\u505a\u91cd\u542f\u3002<br \/>\n\u5efa\u8bae\u91cd\u65b0\u751f\u6210ssl key\uff0c\u907f\u514d\u539f\u5148\u7684key\u5df2\u88ab\u7a83\u53d6<\/p>\n","protected":false},"excerpt":{"rendered":"<p>openssl \u5b98\u65b9\u7f51\u7ad94\u67087\u65e5\u7684\u516c\u5e03\uff1a\u6709\u7814\u7a76\u4eba\u5458&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[103,5],"tags":[75],"_links":{"self":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/513"}],"collection":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=513"}],"version-history":[{"count":5,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/513\/revisions"}],"predecessor-version":[{"id":516,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/513\/revisions\/516"}],"wp:attachment":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=513"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}