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
Padding Oracle Attack
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
zhouyunao
June 14, 2019
Technology
620
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Padding Oracle Attack
zhouyunao
June 14, 2019
More Decks by zhouyunao
See All by zhouyunao
knock
zhouyunao
0
48
Other Decks in Technology
See All in Technology
令和の今、あらためて IAM を考える。アクセスキーを「無くせない現実」との向き合い方
kazzpapa3
0
530
JAWSコミュニティに 参加して1年経った結果
ssakita
0
120
[dbts2026]数十PBの超巨大データ×AI活用を支えるSnowflakeの実力〜大規模環境におけるアーキテクチャと運用のリアル〜
y_matsubara
0
120
BALLAS Technology Deck
ballas_inc
0
340
Microsoft Entra Kerberos で実現するクラウド デバイス管理
tamaiyutaro
2
650
Sizing, Benchmarking and Performance Tuning Apache Flink Clusters
rmetzger
0
140
自律的なチームを作るためにTechPMがやらないこと
ny7760
1
530
cdkd (CDK Direct)
gotok365
4
270
HQ駆動開発で最高のAI-Contextを作ろう
sansantech
PRO
1
120
IBC 2026 動画技術関連レポート / IBC 2026 Report
cyberagentdevelopers
PRO
2
440
Claude Codeで作ったアプリを安全に公開する/Built with Claude Japan 2026
yoshidashingo
0
210
「いつか使う」の「いつか」は来ない 〜AI駆動開発における「作らない」判断について〜
ikki0006
0
170
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
300
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Between Models and Reality
mayunak
4
570
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
68k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
4 Signs Your Business is Dying
shpigford
187
23k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
650
Navigating Weather and Climate Data
rabernat
0
590
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
760
Transcript
Padding Oracle with INSHACK 2019 jean bash picoctf2018 Magic padding
oracle 2019/6/14 m1z0r3 @Zhouyunao
⽬次 n Padding Oracle Attack l Encryption Attack l Decryption
Attack n 実践問題 2019/6/13 m1z0r3
n 概略 l 共通鍵ブロック暗号のCBCモードに対する攻撃⼿法 l 14年SSL3.0のPOODLEという脆弱性もこの⼿法 n CTFに置いての位置付け l ちょくちょく⾒る
l 初⾒としはうざい 2019/6/13 m1z0r3 Padding Oracle Attack
n 特徴 (あくまでも⾃分経験上の話) l CBCモード ←必須 l AES類のブロック暗号 ←必須 l
サーバーが復号化をやってくれる l サーバーコードは⼤概公開 l IVまでこっちから送られる ←場合によって 2019/6/13 m1z0r3 Padding Oracle Attack
n 何ができる︖ l Decryption Attack 難易度:⾼ 暗号⽂の復号ができる 平⽂はflagの場合 l Encryption
Attack 難易度:中 暗号⽂の改造による平⽂の改ざん 平⽂を特定なコマンド/データに改ざんし認証をバイパスできる 2019/6/13 m1z0r3 Padding Oracle Attack
n イメージ 2019/6/13 m1z0r3 Encryption Attack # a&…86 % +
+ + # ) user…
n イメージ 2019/6/13 m1z0r3 Encryption Attack # 01…8c % +
+ + # ) admin…
n 本来なら ) ⨁ 2 = ” … ” n
平⽂をすり替える為に差を計算 = “ … ”⨁” … ” n 差と⼀個前のブロックとxor )⨁⨁(%) = “ … ” 2019/6/13 m1z0r3 Encryption Attack
n それをサーバーに送ると 2019/6/13 m1z0r3 Encryption Attack # 01…8c % +
+ + # xxxxx admin… 最後のブロックを変える為に前のブロックを犠牲にする ※全ブロックを弄る⽅法もあります(後ほど説明)
n さらなる特徴(経験上) l PKCS7を使いがち l Padding errorの時のエラー⽂が特殊 n どうやる︖ 簡単にいうと
前のブロックをいじって、違うpaddingの形式に復号させ、 求めたいブロック平⽂⼀歩⼿前のDec(ct)を求めて、平⽂を取り 出す 2019/6/13 m1z0r3 Decryption Attack
2019/6/13 m1z0r3 Decryption Attack 1c a d m i n
u s e r 07 07 07 07 07 07 01 xx + + Dec Dec + xxxxx ) ブルートフォース ※適当に埋めた
2019/6/13 m1z0r3 Decryption Attack 2f 1c a d m i
n u s e r 07 07 07 07 07 02 02 yy xx 01 02 Dec + ) + Dec xxxxx + + + 01 ブルートフォース済み の部分を新しいpadding 形式に合わせる
2019/6/13 m1z0r3 Decryption Attack 3e 2f 1c a d m
i n u s e r 07 07 07 07 03 03 03 zz yy xx 02 01 03 03 + + + + Dec xxxxx Dec + )
2019/6/13 m1z0r3 Decryption Attack 4a 3e 2f 1c a d
m i n u s e r 07 07 07 04 04 04 04 aa zz yy xx 03 02 01 04 04 04 + + + + Dec xxxxx Dec + )
オ ラ ク ル 。 。 。 2019/6/13 m1z0r3 Decryption
Attack
2019/6/13 m1z0r3 Decryption Attack gy f1 ez dx cp bk
ag 9l 8i 7u 6n 5b 4a 3e 2f 1c 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 qq zz cc vv ee nn ll hh gg bb ee ff aa zz yy xx 0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + + + + Dec xxxxx Dec + ) 全部¥x10になる為既知明⽂か らDec(ct1)を計算して最後ct0と xor取り最後のブロックを算出
2019/6/13 m1z0r3 Decryption Attack gy f1 ez dx cp bk
ag 9l 8i 7u 6n 5b 4a 3e 2f 1c 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 qq zz cc vv ee nn ll hh gg bb ee ff aa zz yy xx 0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + + + + Dec xxxxx Dec + ) ′# ′) ′# ′) が10(padding)に埋め 尽くされた時: ′# ⨁ 1010. . = () ) () )⨁ # = )
2019/6/13 m1z0r3 全ブロックのEncryption Attack # 01…8c % + + +
# xxxxx user… + # admin… n Step 1 最後の2ブロックから差分を計算
n Step 2 前の2ブロックに移動 2019/6/13 m1z0r3 全ブロックのEncryption Attack xxxx 01…8c
% + + + # xxxxx user… + # admin… + ) I am…
n Step 3 2019/6/13 m1z0r3 全ブロックのEncryption Attack xxxx 01…8c %
+ + + # xxxxx user… + # admin… + ) I am… + % Yes… 最後は1ブロック⽬を すりかえられるよう に差分を計算
n picoctf 2018 magic padding oracle l De+Encryption Attack l
https://kusuwada.hatenablog.com/entry/2019/04/17/052525 n INS’hack 2019 Jean-Sébastien Bash l Encryption Attack l https://www.hackademint.org/Jean-Sebastien_Bash 2019/6/13 m1z0r3 実践問題
n http://rintaro.hateblo.jp/entry/2017/12/31/174327 2019/6/13 m1z0r3 レファレンス