SlideShare a Scribd company logo
Bleichenbacher RSA Signature Forgery ( 2006 )
oalieno
PKCS
PKCS
• PKCS ( Public Key Cryptography Standards ) 是公鑰密碼標準

• 制定了了⼀一系列列從 PKCS#1 到 PKCS#15 的標準

• 其中 PKCS#1 是 RSA Cryptography Standard
ASN.1
• ASN.1 是⾼高階的抽象標準

• 具體的實作編碼規則有 : BER, CER, DER, PER, XER
PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
Step 1 : Message Digest
M
H(M)
HASH
Sign
• ASN.1 是編碼數據的格式,這裡紀錄了了使⽤用的 hash 演算法
H(M)ASN.101 FF … 00FFD = 00
padding
Step 2 : Data EncodingSign
PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
Step 3 : RSA encryption
D
d
% n = S
Sign
PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
Step 1 : RSA decryptionVerify
S
e
% n = D
PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
Step 2 : Data DecodingVerify
• 需要 parse 這個格式取出 H(M)

• 這個標準沒有說要怎麼 parse

• 如果 e 太⼩小且沒有正確的 parse,就有機會偽造簽章
H(M)ASN.101 FF … 00FFD = 00
PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
Step 3 : Message digesting and comparison
M'
H(M)'
H(M)
Verify
compare
PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
Bleichenbacher RSA Signature Forgery ( 2006 )
Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE
• ⼜又稱作 BB06

• 針對 PKCS#1 1.5 ( RFC 2313 )

• RSA 簽章偽造
06
Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE
• 實作缺陷 : 可以有多餘的字元在後⾯面

• parse 的時候直接取出後⾯面固定長度的 H(M)

• 沒有檢查後⾯面還有沒有東⻄西
H(M)ASN.101 FF … 00FF00 Garbage
• 在 e = 3 的情況下可以 forge signature

• 嘗試構造 ED 讓 ED 的三次⽅方不超過 n 且滿⾜足以下格式
S
3
% n
= H(M)ASN.101 FF … 00FF00 Garbage
Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE
H(M)ASN.101 FF … 00FF Garbage00
D ( length d ) G ( length g )
2t−15
G+
total length t
(x + y)3
x3
3x2
y+
2g
⋅ D+−2d+g
3xy2 y3
+ +=
Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE
x = 2
t − 15
3
y =
(D − 2d
) ⋅ 2g
3 ⋅ 2
2(t − 15)
3
Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE
x = 21019
y =
(D − 2288
) ⋅ 234
3
• 假設

• Key 長度為 3072 bit

• Garbage 長度為 2072 bit

• 使⽤用 SHA-1 的話,D 的長度是 288 bit

• 最後 ED = x + y 就是我們構造出的合法簽章
Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE
RSA Signature Forgery in python-rsa ( 2016 )
CVE-2016-1494
RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
• 實作缺陷 : padding bytes 可以是任意字元
直接取第⼆二個 0x00 沒有檢查中間的 padding bytes
• 在 e = 3 的情況下可以 forge signature

• 嘗試構造 ED 讓 ED 的三次⽅方不超過 n 且滿⾜足以下格式

• ED3 的後綴是 ASN.1 + H(M)

• ED3 的前綴是 x00x01
H(M)ASN.101 ?? … 00??00
S
3
% n
=
RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
0S
S3
⽬目標
0 0 1
0 0 0 1
1 1 0 1
match
RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
0S
S3
⽬目標
0 0 1
0 0 0 1
1 1 0 1
match
RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
0S
S3
⽬目標
0 0 1
0 0 0 1
1 1 0 1
mismatch
RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
0S
S3
⽬目標
1 0 1
1 1 0 1
1 1 0 1
match
RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
0S
S3
⽬目標
1 0 1
1 1 0 1
1 1 0 1
match
RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
0S
S3
⽬目標
1 0 1
1 1 0 1
1 1 0 1
01013 = 1111101
RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
01 … …00
3
= 923f … 68 04
bc 2876e450… =
3
• 要讓 ED3 的前綴是 x00x01 只要把 x00x01... 開三次⽅方

• 最後再把開完三次⽅方的值的後綴換成前⾯面算出來來的後綴

• 就可以成功⾃自⼰己構造合法簽章了了
RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
H(M)ASN.101 ?? … 00??00
923f … bc 28
3
=
RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
A Decade After Bleichenbacher '06, RSA
Signature Forgery Still Works ( 2019 )
A Decade After Bleichenbacher '06, RSA
Signature Forgery Still Works ( 2019 )https://i.blackhat.com/USA-19/Wednesday/us-19-Chau-A-Decade-After-Bleichenbacher-06-RSA-Signature-Forgery-Still-Works.pdf
• 整個格式固定是 n 這麼長

• ⽤用 Symbolic Execution 去找到可以任意亂塞的部分有多長
A Decade After Bleichenbacher '06, RSA
Signature Forgery Still Works ( 2019 )https://i.blackhat.com/USA-19/Wednesday/us-19-Chau-A-Decade-After-Bleichenbacher-06-RSA-Signature-Forgery-Still-Works.pdf
• 實作缺陷 : padding bytes 可以是任意字元
H(M)ASN.101 ?? … 00??00
CVE-2018-15836Openswan 2.6.50
CVE-2018-16152strongSwan 5.6.3
A Decade After Bleichenbacher '06, RSA
Signature Forgery Still Works ( 2019 )https://i.blackhat.com/USA-19/Wednesday/us-19-Chau-A-Decade-After-Bleichenbacher-06-RSA-Signature-Forgery-Still-Works.pdf
• 實作缺陷 :

• Algorithm Parameter 可以是任意字元

• Algorithm OID 後⾯面可以有多餘的字元
H(M)01 FF … 00FF00 ASN.100
03 20 03 0c Algorithm Parameter 04 10Algorithm OID
CVE-2018-16150axTLS 2.1.3
A Decade After Bleichenbacher '06, RSA
Signature Forgery Still Works ( 2019 )https://i.blackhat.com/USA-19/Wednesday/us-19-Chau-A-Decade-After-Bleichenbacher-06-RSA-Signature-Forgery-Still-Works.pdf
• 實作缺陷 :

• 可以有多餘的字元在後⾯面

• Algorithm Identifier 可以是任意字元
H(M)01 FF … 00FF00 ASN.100
03 20 03 0c Algorithm Identifier 04 10
Garbage
Defense against RSA Signature Forgery
How to defense?
• ⽤用其他的簽章演算法,比如說 ECDSA

• ⽤用更更⼤大的 e,比如 65537

• parsing based → comparison based
H(M)ASN.101 FF … 00FF00
H(M)ASN.101 FF … 00FF00
compare

More Related Content

What's hot

Pilferproof packaging
Pilferproof packagingPilferproof packaging
Pilferproof packaging
Anil Pethe
 
Types of dairies and perisable nature of milk.ppt
Types of dairies and perisable nature of milk.pptTypes of dairies and perisable nature of milk.ppt
Types of dairies and perisable nature of milk.ppt
Surendra664913
 
Bubble Wrap and its Benefits
Bubble Wrap and its BenefitsBubble Wrap and its Benefits
Bubble Wrap and its Benefits
MS Packaging
 
Processing, tamper evident packing, child resistant packing, closures
Processing, tamper evident packing, child resistant packing, closuresProcessing, tamper evident packing, child resistant packing, closures
Processing, tamper evident packing, child resistant packing, closures
Homendra Sahu
 
India Food Licensing & Registration: Impact to Industry
India Food Licensing & Registration: Impact to IndustryIndia Food Licensing & Registration: Impact to Industry
India Food Licensing & Registration: Impact to Industry
Asian Food Regulation Information Service
 
fssai structure.pptx
fssai structure.pptxfssai structure.pptx
fssai structure.pptx
RituJaiswal17
 
International organisation for Standardization
International organisation for StandardizationInternational organisation for Standardization
International organisation for Standardization
Amruta Balekundri
 

What's hot (7)

Pilferproof packaging
Pilferproof packagingPilferproof packaging
Pilferproof packaging
 
Types of dairies and perisable nature of milk.ppt
Types of dairies and perisable nature of milk.pptTypes of dairies and perisable nature of milk.ppt
Types of dairies and perisable nature of milk.ppt
 
Bubble Wrap and its Benefits
Bubble Wrap and its BenefitsBubble Wrap and its Benefits
Bubble Wrap and its Benefits
 
Processing, tamper evident packing, child resistant packing, closures
Processing, tamper evident packing, child resistant packing, closuresProcessing, tamper evident packing, child resistant packing, closures
Processing, tamper evident packing, child resistant packing, closures
 
India Food Licensing & Registration: Impact to Industry
India Food Licensing & Registration: Impact to IndustryIndia Food Licensing & Registration: Impact to Industry
India Food Licensing & Registration: Impact to Industry
 
fssai structure.pptx
fssai structure.pptxfssai structure.pptx
fssai structure.pptx
 
International organisation for Standardization
International organisation for StandardizationInternational organisation for Standardization
International organisation for Standardization
 

Similar to [Crypto Course] Bleichenbacher RSA Signature Forgery

Pki guide v1.0a_aka
Pki guide v1.0a_akaPki guide v1.0a_aka
Pki guide v1.0a_aka
WASecurity
 
漫谈编码解码和加密解密
漫谈编码解码和加密解密漫谈编码解码和加密解密
漫谈编码解码和加密解密
Depeng Cong
 
20181120 NISRA - 密碼學沒有入門
20181120 NISRA - 密碼學沒有入門20181120 NISRA - 密碼學沒有入門
20181120 NISRA - 密碼學沒有入門
Chao An Hsiao
 
Oracle Security 101
Oracle Security 101Oracle Security 101
Oracle Security 101
Dahui Feng
 
[Crypto Course] Hash
[Crypto Course] Hash[Crypto Course] Hash
[Crypto Course] Hash
WEI CHIEH CHAO
 
Io t security-ameba-ppt
Io t security-ameba-pptIo t security-ameba-ppt
Io t security-ameba-ppt
Jou Neo
 
Hacking Nginx at Taobao
Hacking Nginx at TaobaoHacking Nginx at Taobao
Hacking Nginx at Taobao
Joshua Zhu
 
Mongo db at qihoo 360
Mongo db at qihoo 360Mongo db at qihoo 360
Mongo db at qihoo 360
2507697439
 
流行应用的加密算法实现缺陷与利用
流行应用的加密算法实现缺陷与利用流行应用的加密算法实现缺陷与利用
流行应用的加密算法实现缺陷与利用
ph4nt0m
 
Elastic stack day-2
Elastic stack day-2Elastic stack day-2
Elastic stack day-2
YI-CHING WU
 
JavaScript现代化排错实践
JavaScript现代化排错实践JavaScript现代化排错实践
JavaScript现代化排错实践jeffz
 
[Crypto Course] Block Cipher Mode
[Crypto Course] Block Cipher Mode[Crypto Course] Block Cipher Mode
[Crypto Course] Block Cipher Mode
WEI CHIEH CHAO
 
基于嵌入式系统的Avs P10编码系统设计
基于嵌入式系统的Avs P10编码系统设计基于嵌入式系统的Avs P10编码系统设计
基于嵌入式系统的Avs P10编码系统设计
Hengyi
 
CKAN : 資料開放平台技術介紹 (CAKN : Technical Introduction to Open Data Portal)
CKAN : 資料開放平台技術介紹 (CAKN : Technical Introduction to Open Data Portal)CKAN : 資料開放平台技術介紹 (CAKN : Technical Introduction to Open Data Portal)
CKAN : 資料開放平台技術介紹 (CAKN : Technical Introduction to Open Data Portal)
Jian-Kai Wang
 
LCC Retarget C Compiler Introduction in Chinese
LCC Retarget C Compiler Introduction in ChineseLCC Retarget C Compiler Introduction in Chinese
LCC Retarget C Compiler Introduction in Chinese
Marco Wang
 
Python 于 webgame 的应用
Python 于 webgame 的应用Python 于 webgame 的应用
Python 于 webgame 的应用
勇浩 赖
 
Oda安装 恢复步骤
Oda安装 恢复步骤Oda安装 恢复步骤
Oda安装 恢复步骤
n-lauren
 
給軟體工程師的不廢話 R 語言精要班
給軟體工程師的不廢話 R 語言精要班給軟體工程師的不廢話 R 語言精要班
給軟體工程師的不廢話 R 語言精要班
台灣資料科學年會
 
twMVC#46_SQL Server 資料分析大躍進 Machine Learning Services
twMVC#46_SQL Server 資料分析大躍進 Machine Learning ServicestwMVC#46_SQL Server 資料分析大躍進 Machine Learning Services
twMVC#46_SQL Server 資料分析大躍進 Machine Learning Services
twMVC
 
LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發
Wei-Tsung Su
 

Similar to [Crypto Course] Bleichenbacher RSA Signature Forgery (20)

Pki guide v1.0a_aka
Pki guide v1.0a_akaPki guide v1.0a_aka
Pki guide v1.0a_aka
 
漫谈编码解码和加密解密
漫谈编码解码和加密解密漫谈编码解码和加密解密
漫谈编码解码和加密解密
 
20181120 NISRA - 密碼學沒有入門
20181120 NISRA - 密碼學沒有入門20181120 NISRA - 密碼學沒有入門
20181120 NISRA - 密碼學沒有入門
 
Oracle Security 101
Oracle Security 101Oracle Security 101
Oracle Security 101
 
[Crypto Course] Hash
[Crypto Course] Hash[Crypto Course] Hash
[Crypto Course] Hash
 
Io t security-ameba-ppt
Io t security-ameba-pptIo t security-ameba-ppt
Io t security-ameba-ppt
 
Hacking Nginx at Taobao
Hacking Nginx at TaobaoHacking Nginx at Taobao
Hacking Nginx at Taobao
 
Mongo db at qihoo 360
Mongo db at qihoo 360Mongo db at qihoo 360
Mongo db at qihoo 360
 
流行应用的加密算法实现缺陷与利用
流行应用的加密算法实现缺陷与利用流行应用的加密算法实现缺陷与利用
流行应用的加密算法实现缺陷与利用
 
Elastic stack day-2
Elastic stack day-2Elastic stack day-2
Elastic stack day-2
 
JavaScript现代化排错实践
JavaScript现代化排错实践JavaScript现代化排错实践
JavaScript现代化排错实践
 
[Crypto Course] Block Cipher Mode
[Crypto Course] Block Cipher Mode[Crypto Course] Block Cipher Mode
[Crypto Course] Block Cipher Mode
 
基于嵌入式系统的Avs P10编码系统设计
基于嵌入式系统的Avs P10编码系统设计基于嵌入式系统的Avs P10编码系统设计
基于嵌入式系统的Avs P10编码系统设计
 
CKAN : 資料開放平台技術介紹 (CAKN : Technical Introduction to Open Data Portal)
CKAN : 資料開放平台技術介紹 (CAKN : Technical Introduction to Open Data Portal)CKAN : 資料開放平台技術介紹 (CAKN : Technical Introduction to Open Data Portal)
CKAN : 資料開放平台技術介紹 (CAKN : Technical Introduction to Open Data Portal)
 
LCC Retarget C Compiler Introduction in Chinese
LCC Retarget C Compiler Introduction in ChineseLCC Retarget C Compiler Introduction in Chinese
LCC Retarget C Compiler Introduction in Chinese
 
Python 于 webgame 的应用
Python 于 webgame 的应用Python 于 webgame 的应用
Python 于 webgame 的应用
 
Oda安装 恢复步骤
Oda安装 恢复步骤Oda安装 恢复步骤
Oda安装 恢复步骤
 
給軟體工程師的不廢話 R 語言精要班
給軟體工程師的不廢話 R 語言精要班給軟體工程師的不廢話 R 語言精要班
給軟體工程師的不廢話 R 語言精要班
 
twMVC#46_SQL Server 資料分析大躍進 Machine Learning Services
twMVC#46_SQL Server 資料分析大躍進 Machine Learning ServicestwMVC#46_SQL Server 資料分析大躍進 Machine Learning Services
twMVC#46_SQL Server 資料分析大躍進 Machine Learning Services
 
LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發
 

[Crypto Course] Bleichenbacher RSA Signature Forgery

  • 1. Bleichenbacher RSA Signature Forgery ( 2006 ) oalieno
  • 3. PKCS • PKCS ( Public Key Cryptography Standards ) 是公鑰密碼標準 • 制定了了⼀一系列列從 PKCS#1 到 PKCS#15 的標準 • 其中 PKCS#1 是 RSA Cryptography Standard
  • 4. ASN.1 • ASN.1 是⾼高階的抽象標準 • 具體的實作編碼規則有 : BER, CER, DER, PER, XER
  • 6. • ASN.1 是編碼數據的格式,這裡紀錄了了使⽤用的 hash 演算法 H(M)ASN.101 FF … 00FFD = 00 padding Step 2 : Data EncodingSign PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
  • 7. Step 3 : RSA encryption D d % n = S Sign PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
  • 8. Step 1 : RSA decryptionVerify S e % n = D PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
  • 9. Step 2 : Data DecodingVerify • 需要 parse 這個格式取出 H(M) • 這個標準沒有說要怎麼 parse • 如果 e 太⼩小且沒有正確的 parse,就有機會偽造簽章 H(M)ASN.101 FF … 00FFD = 00 PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
  • 10. Step 3 : Message digesting and comparison M' H(M)' H(M) Verify compare PKCS#1 1.5 Signaturehttps://tools.ietf.org/html/rfc2313
  • 11. Bleichenbacher RSA Signature Forgery ( 2006 )
  • 12. Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE • ⼜又稱作 BB06 • 針對 PKCS#1 1.5 ( RFC 2313 ) • RSA 簽章偽造 06
  • 13. Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE • 實作缺陷 : 可以有多餘的字元在後⾯面 • parse 的時候直接取出後⾯面固定長度的 H(M) • 沒有檢查後⾯面還有沒有東⻄西 H(M)ASN.101 FF … 00FF00 Garbage
  • 14. • 在 e = 3 的情況下可以 forge signature • 嘗試構造 ED 讓 ED 的三次⽅方不超過 n 且滿⾜足以下格式 S 3 % n = H(M)ASN.101 FF … 00FF00 Garbage Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE
  • 15. H(M)ASN.101 FF … 00FF Garbage00 D ( length d ) G ( length g ) 2t−15 G+ total length t (x + y)3 x3 3x2 y+ 2g ⋅ D+−2d+g 3xy2 y3 + += Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE
  • 16. x = 2 t − 15 3 y = (D − 2d ) ⋅ 2g 3 ⋅ 2 2(t − 15) 3 Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE
  • 17. x = 21019 y = (D − 2288 ) ⋅ 234 3 • 假設 • Key 長度為 3072 bit • Garbage 長度為 2072 bit • 使⽤用 SHA-1 的話,D 的長度是 288 bit • 最後 ED = x + y 就是我們構造出的合法簽章 Bleichenbacher RSA Signature Forgery ( 2006 )https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE
  • 18. RSA Signature Forgery in python-rsa ( 2016 ) CVE-2016-1494
  • 19. RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/ • 實作缺陷 : padding bytes 可以是任意字元 直接取第⼆二個 0x00 沒有檢查中間的 padding bytes
  • 20. • 在 e = 3 的情況下可以 forge signature • 嘗試構造 ED 讓 ED 的三次⽅方不超過 n 且滿⾜足以下格式 • ED3 的後綴是 ASN.1 + H(M) • ED3 的前綴是 x00x01 H(M)ASN.101 ?? … 00??00 S 3 % n = RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
  • 21. 0S S3 ⽬目標 0 0 1 0 0 0 1 1 1 0 1 match RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
  • 22. 0S S3 ⽬目標 0 0 1 0 0 0 1 1 1 0 1 match RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
  • 23. 0S S3 ⽬目標 0 0 1 0 0 0 1 1 1 0 1 mismatch RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
  • 24. 0S S3 ⽬目標 1 0 1 1 1 0 1 1 1 0 1 match RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
  • 25. 0S S3 ⽬目標 1 0 1 1 1 0 1 1 1 0 1 match RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
  • 26. 0S S3 ⽬目標 1 0 1 1 1 0 1 1 1 0 1 01013 = 1111101 RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
  • 27. 01 … …00 3 = 923f … 68 04 bc 2876e450… = 3 • 要讓 ED3 的前綴是 x00x01 只要把 x00x01... 開三次⽅方 • 最後再把開完三次⽅方的值的後綴換成前⾯面算出來來的後綴 • 就可以成功⾃自⼰己構造合法簽章了了 RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
  • 28. H(M)ASN.101 ?? … 00??00 923f … bc 28 3 = RSA Signature Forgery in python-rsa ( 2016 )https://blog.filippo.io/bleichenbacher-06-signature-forgery-in-python-rsa/
  • 29. A Decade After Bleichenbacher '06, RSA Signature Forgery Still Works ( 2019 )
  • 30. A Decade After Bleichenbacher '06, RSA Signature Forgery Still Works ( 2019 )https://i.blackhat.com/USA-19/Wednesday/us-19-Chau-A-Decade-After-Bleichenbacher-06-RSA-Signature-Forgery-Still-Works.pdf • 整個格式固定是 n 這麼長 • ⽤用 Symbolic Execution 去找到可以任意亂塞的部分有多長
  • 31. A Decade After Bleichenbacher '06, RSA Signature Forgery Still Works ( 2019 )https://i.blackhat.com/USA-19/Wednesday/us-19-Chau-A-Decade-After-Bleichenbacher-06-RSA-Signature-Forgery-Still-Works.pdf • 實作缺陷 : padding bytes 可以是任意字元 H(M)ASN.101 ?? … 00??00 CVE-2018-15836Openswan 2.6.50
  • 32. CVE-2018-16152strongSwan 5.6.3 A Decade After Bleichenbacher '06, RSA Signature Forgery Still Works ( 2019 )https://i.blackhat.com/USA-19/Wednesday/us-19-Chau-A-Decade-After-Bleichenbacher-06-RSA-Signature-Forgery-Still-Works.pdf • 實作缺陷 : • Algorithm Parameter 可以是任意字元 • Algorithm OID 後⾯面可以有多餘的字元 H(M)01 FF … 00FF00 ASN.100 03 20 03 0c Algorithm Parameter 04 10Algorithm OID
  • 33. CVE-2018-16150axTLS 2.1.3 A Decade After Bleichenbacher '06, RSA Signature Forgery Still Works ( 2019 )https://i.blackhat.com/USA-19/Wednesday/us-19-Chau-A-Decade-After-Bleichenbacher-06-RSA-Signature-Forgery-Still-Works.pdf • 實作缺陷 : • 可以有多餘的字元在後⾯面 • Algorithm Identifier 可以是任意字元 H(M)01 FF … 00FF00 ASN.100 03 20 03 0c Algorithm Identifier 04 10 Garbage
  • 34. Defense against RSA Signature Forgery
  • 35. How to defense? • ⽤用其他的簽章演算法,比如說 ECDSA • ⽤用更更⼤大的 e,比如 65537 • parsing based → comparison based H(M)ASN.101 FF … 00FF00 H(M)ASN.101 FF … 00FF00 compare