Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
[Crypto in CTF] HASH
Search
oalieno
October 31, 2020
Technology
360
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[Crypto in CTF] HASH
https://github.com/oalieno/Crypto-Course/tree/master/HASH
oalieno
October 31, 2020
More Decks by oalieno
See All by oalieno
[Crypto in CTF] Classical Cipher
oalieno
0
520
[Crypto in CTF] Block Cipher Mode
oalieno
0
1.1k
[Crypto in CTF] LFSR
oalieno
0
590
[Crypto in CTF] RSA
oalieno
0
840
[Crypto in CTF] Bleichenbacher RSA Signature Forgery
oalieno
0
680
[Crypto in CTF] Blockchain Security
oalieno
0
470
滲透測試基本技巧與經驗分享
oalieno
2
1.2k
Other Decks in Technology
See All in Technology
AI駆動開発における開発環境のセキュリティの考え方
yamahiro
2
620
これだけは抑えておきたい!後悔しない re:Invent の過ごし方 / AWS re:Invent 2026 prestudy
kinunori
2
380
外国人エンジニアがVueプロトタイプで仕様を合わせている話 / Vue Fes Japan 2026 LT
eluwing
0
170
ドメインエキスパートは いかにして AI を使って プロダクト開発をするか
tatsuyashiraishi
1
190
"計画的無茶振り"を通してAIネイティブ世代の新人を育てる
subroh0508
1
110
トークン化預金DCJPYの取り組みと活用ユースケース
finengine
0
250
Metadata - Section 2: Simple Metadata & Meta Tags
mohab1
0
140
AIコーディングを実践してきた1年を振り返る / Looking Back on a Year of Practicing AI Coding
takedatakashi
1
140
QAエンジニアがSoutherを使ってみたの〜10分でわかるSouther〜
mhlyc
0
120
E2Eってつらくないですか?E2Eの管理コストを下げる手段とその実践
akaboshinit
1
290
小規模OSSモデルは サイバーセキュリティ業務に どこまで使えるか
bbrbbq
0
300
あなたのDartコードは丸見えかもしれない ~reFlutterで暴くFlutterアプリの中身と多層防御~
zozotech
PRO
0
170
Featured
See All Featured
Writing Fast Ruby
sferik
630
63k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
630
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
860
Designing Experiences People Love
moore
143
24k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
650
Embracing the Ebb and Flow
colly
88
5.2k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
470
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
440
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
600
4 Signs Your Business is Dying
shpigford
187
23k
Transcript
HASH oalieno
Introduction to Hash hash function 任意長度資料 固定長度資料 特性 : 單向函式,不可逆
碰撞 • 碰撞 ( Collision ) : hash function 是將無限⼤⼩的集合映射到有限⼤⼩的集合
根據鴿籠原理,產⽣夠多 hash value 後⼀定會有重複的 也就是碰撞 ( Collision ) hash function cat 3b48 hash function dog 3b48
Merkle–Damgård Construction https://www.youtube.com/watch?v=sawkPgsQPwg 許多的 hash function 是⽤這種構造⽅式 ( ex: md5,
sha1, sha256, … )
Rainbow Table - 彩虹表的前⾝ • 字典攻擊是預先儲存⼀個很⼤的資料庫 • 裡⾯包含許多字串的 hash value
• 透過查表的⽅式找回 hash key • ⽤空間換取時間 aaa 47bce5c7 aab e62595ee aac a9ced3da aad c2f7ab46 … …
Rainbow Table - 建立彩虹表 彩虹表和字典攻擊⼀樣是⽤空間換取時間,但彩虹表多犧牲了⼀點時間來換去更⼩的空間 p0 H q0 p1 R
q1 H … pn-1 H qn-1 R pn hash 鍊 記下這個 記下這個
Rainbow Table - 查找彩虹表 ⼯具 • ophcrack • rainbowcrack •
rtgen
MD5 Collision - 碰撞實測 https://www.mathstat.dal.ca/~selinger/md5collision/ 將兩串不同的 data 寫入檔案 ⽤ md5sum
看看他的 hash value $ echo d131dd02c5e6eec4693d9a0698aff95c2fcab58712467eab4004583eb8fb7f8955ad340609f4b30283e488832571415a085125e8f7cdc99fd91dbdf280373c5bd8823e3156348f5bae6dacd436c919c6dd53e2b487da03fd02396306d248cda0e99f33420f577ee8ce54b67080a80d1ec69821bcb6a8839396f9652b6ff72a70 | xxd -r -p > A $ echo d131dd02c5e6eec4693d9a0698aff95c2fcab50712467eab4004583eb8fb7f8955ad340609f4b30283e4888325f1415a085125e8f7cdc99fd91dbd7280373c5bd8823e3156348f5bae6dacd436c919c6dd53e23487da03fd02396306d248cda0e99f33420f577ee8ce54b67080280d1ec69821bcb6a8839396f965ab6ff72a70 | xxd -r -p > B
MD5 Collision - 碰撞應⽤ https://www.mathstat.dal.ca/~selinger/md5collision/ 給任意的初始值 si ⽤ method of
Wang and Yu 可以找到 Mi, Mi+1 和 Ni, Ni+1 使得 ⽤這種⽅法可以構造出下⾯這樣的程式 ( 他們的 MD5 相等 ) MD5雜湊值相等 si
SHA1 Collision Google 在 2017 年 2 ⽉ 23 號
發表了兩份有⼀模⼀樣的 SHA1 checksum 的 PDF https://shattered.io/
SHA1 Collision Boston Key Party CTF 2017 在 2017 年
2 ⽉ 25 號 ⾺上出了⼀題 SHA1 collision 的題⽬ Boston Key Party CTF 2017 - prudentialv2 要讓 name != password 但是 sha1(name) == sha1(password) 直接把 google 找到的那兩個 PDF 傳過去就對了XD
SHA1 Collision Seccon CTF 2017 - SHA-1 is dead 也是
SHA1 collision 上傳兩個檔案滿⾜ : 1.file1 != file2 2.SHA1(file1) == SHA1(file2) 3.2017 KiB < sizeof(file1) < 2018 KiB 4.2017 KiB < sizeof(file2) < 2018 KiB KiB = 1024 bytes KB = 1000 bytes $ python3 -c "print('A' * (2017 * 1024 - 422435 + 1), end = '')" >> shattered-1.pdf $ python3 -c "print('A' * (2017 * 1024 - 422435 + 1), end = '')" >> shattered-2.pdf
Length Extension Attack • 當我們的 Message Authentication 是 H(salt ||
message) 的形式 • ⽽我們的 hash function H 是 Merkle–Damgård Construction • 我們就可以繞過 MAC 的驗證機制,對明⽂串接部分可控資料
Length Extension Attack salt m[0] m[n] + padding … append
new padding IV H0 H1 Hn … Hn+1 … Hm Continue Hashing • 在改動明⽂後重新計算 hash • salt 已經在前⾯被計算過了,完全不⽤理他 • 新的明⽂包含 message || padding || append
HashPump https://github.com/bwall/HashPump 不⽤⾃⼰指定要⽤哪個 Hash Function 預設會⾃動根據 H(salt || message) 這個
hash 的長度判斷 new hash new message
CTF • TUM CTF Teaser - bad_apple • RuCTF Quals
2014 - MD5 lext • Teaser CONFidence CTF 2015 - Mac hacking • BAMBOOFOX CTF 2018 - baby-lea