SlideShare a Scribd company logo
1 of 25
SMACK: State Machine AttaCKs
AJ (張仁傑)
<ajblane0612@gmail.com>
2015.8.18
若渴計畫
因為沒實際看過code,跑過TLS流程,所以很多
內容都是看paper文字推敲,歡迎指教討論。
SMACK作者提供的資訊
• Slides from IEEE S&P 2015
• Preprint of the paper
• OpenSSL state monitor code verified with Frama-C
• Proof of transcript injectivity verified in F*
• Source code for the flexTLS tool
https://www.smacktls.com/
請自備8G記憶體以上的電腦 GG
Outline
• Public key system
• Certificate authority (CA)
• Diffie–Hellman key exchange
• RSA key exchange
• Transport Layer Security (TLS)
• SMACK: State Machine AttaCKs
Public Key System
• P+ : public key, P- : private key
Sender
• P+
• P-
Receiver
• P+ (經Sender傳輸)
P+(P-(Sender’s message) )
= Sender’s message
P+(Receiver’s message)
P-(P+(Receiver’s message) )
= Receiver's message
P+, P-(Sender’s message)
Certificate Authority (CA)
Dick以為中間人的Public key為
Tom的public key,所以有CA是
提供一個機制來驗證是不是
Tom的public key。
CA certificate public key
(提早就拿好的) @@?
signature
sign Tom’s public key certificate
(CA’s private key)
+
Net 2.0 – cryptographic - functionality is now complete,http://www.nxtgenug.net/Article.aspx?ArticleID=42
https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange
Diffie–Hellman Key Exchange
可當作為要交換的key,
例如: public key system中,
sender把public key傳給
receiver就可以用這個方
法傳遞。
RSA Key Exchange
https://technet.microsoft.com/en-us/library/cc962035.aspx
可來自CA
TLS(Transport Layer Security)使用以上技巧,
在閱讀TLS時,太多key一時搞不清楚這些
key是有哪些不同,拿來幹麻的!有些文件
沒提,必須自己想像,好痛苦阿
RSA Key Exchange
Diffie–Hellman Key Exchange
Certificate Authority (CA)
Public Key System
The TLS State Machine
Client/Server雙方say hello
• 同步他們的狀態
• 同意的session ID
• 同意的ciphersuite
• 各自交換的
Random numbers
(nonces)
• …
The TLS State Machine
ServerCertificate
• CA概念,所以client
會有個signature,
server必須傳public
key來給client進行
server的認證。
用哪種key exchange?
ciphersuite決定
Server可當CA?
可 (這就有問題了)
Client擁有server signature是怎來的@@?
• First, the client sends a client hello message with a maximum protocol
version pvmax, a random nonce cr, and a set of proposed ciphersuites
and extensions. The server chooses a version pv, a ciphersuite, and a
subset of these extensions, and responds with its own nonce sr and
session identifier sid . The server then sends its X.509 certificate chain
certS and public key pkS.
• 這..於是這篇paper開始用MAN-IN-THE-MIDDLE攻擊,下次會介紹。
“Triple Handshakes and Cookie Cutters: Breaking and Fixing Authentication over TLS”
The TLS State Machine
ServerKeyExchange
• 使用public key system
需交換public key透過
DHE
那使用RSA,如何進行
server認證?
概念是cleint/server都
用一把相同的private
key來解,假設中間人
沒有此private key。
The TLS State Machine
ServerHelloDone
• 經過server key exchange,
client會有一把CA’s
public key來解signature。
解完signature,client會
有一把public key,
之後用此key傳訊息給
server。之後其實沒有
多久,就會在換一把
key了。
• 當然此時,也會依據
negotiation parameters ,
是否要不要client認證。
ClientKeyExchange
• 剛所提的之後來了,
client會依據nonces
來產生client/server
之間傳遞訊息的secrete
Key。
• RSA的key exchange
ClientCCS/ServerCCS
• Change Cipher Spec(CCS).
通訊間所使用的key又可
以改,到底是要改幾次
阿~“~。
上述的TLS是基本形式,根據ciphersuite/
negotiation parameters ,你會沒有看過的加密
使用方法,超複雜的! 而且key改那麼多次,到
底是怎攻擊的阿@@?
SMACK: State Machine AttaCKs
Threat Model
Key idea: 中間人想要竊取資訊,有沒有找到一個
未預期TLS state machine,假裝client/server,並可
以正常運作。
如何找出TLS State Machine未預期的行為
• 在TLS每階段結束時,client/server各自送出illegal message,並各自等待回
• 回傳的訊息會有三種: correct/ unsupported/ buggy (期待client/server會有怎樣
的illegal message處理)
• 在”Protocol state fuzzing of TLS implementations”,他送的不只illegal message,
來找TLS state machine的非預期行為。
為了automated testing發
展了FLEXTLS script
(compiler) ~”~
驚人的事發生了
OpenSSL Client and Server State machine for HTTPS configurations. Unexpected transitions:
client in red on the right, server in green on the left
你要知道,紅色綠色是OpenSSL可
能會執行的行為
Revealing Unexpected State Machine
• Server-Gated Crypto(SGC)
• client在ServerHello階段,
可以重新handshake
• Early CCS
• OpenSSL允許未初始的session key
做session key的計算
• CVE-2014-0224
• DH Certificate (Client impersonation)
• OpenSSL允許DH的public key來計算
session的pre-master secrete,所以可
skip ClientCertificateVerify
• 此流程可以新增假client來攻擊,
因為你沒做client驗證。
Revealing Unexpected State Machine
• Export RSA (skip ServerKeyExchange)
• RSA exchange是weak的
• 在server送簽證時,要交換key,
硬是只能用RSA (downgrade attack)
• Static DH
• 假設使用DH且要執行ServerKeyExchnage,
但是client沒有接收到ServerKeyExchnage,驗證所需public key將會rollback
到public key of server’s certificate。rollback涵義是DH交換的public key機制
比較強。
• RSA也會有這狀況,從RSA->RSA_EXPORT,多一個ServerKeyExchange
(FREAK: Downgrade to RSA_EXPORT/ Inject ServerkeyExchange)
Export RSA
Static DH
有了這些Unexpected的狀況(其實還不只),如
何來攻擊?
例子: FREAK,其實還很多可參考 ”A Messy State
of the Union: Taming the Composite State
Machines of TSL“
FREAK: Downgrade to RSA_EXPORT
心得
• TLS他運作超複雜感覺非常強,為什麼可以找出非預期狀況執行,
因為本身考慮到”方便性”,因為有了”方便”,就會是漏洞的開始。

More Related Content

Viewers also liked

Webinar - How to Build Data Pipelines for Real-Time Applications with SMACK &...
Webinar - How to Build Data Pipelines for Real-Time Applications with SMACK &...Webinar - How to Build Data Pipelines for Real-Time Applications with SMACK &...
Webinar - How to Build Data Pipelines for Real-Time Applications with SMACK &...DataStax
 
Architecture Big Data open source S.M.A.C.K
Architecture Big Data open source S.M.A.C.KArchitecture Big Data open source S.M.A.C.K
Architecture Big Data open source S.M.A.C.KJulien Anguenot
 
Laying down the smack on your data pipelines
Laying down the smack on your data pipelinesLaying down the smack on your data pipelines
Laying down the smack on your data pipelinesPatrick McFadin
 
SMACK Stack 1.1
SMACK Stack 1.1SMACK Stack 1.1
SMACK Stack 1.1Joe Stein
 
Streaming Analytics with Spark, Kafka, Cassandra and Akka by Helena Edelson
Streaming Analytics with Spark, Kafka, Cassandra and Akka by Helena EdelsonStreaming Analytics with Spark, Kafka, Cassandra and Akka by Helena Edelson
Streaming Analytics with Spark, Kafka, Cassandra and Akka by Helena EdelsonSpark Summit
 
Data processing platforms with SMACK: Spark and Mesos internals
Data processing platforms with SMACK:  Spark and Mesos internalsData processing platforms with SMACK:  Spark and Mesos internals
Data processing platforms with SMACK: Spark and Mesos internalsAnton Kirillov
 
Kick-Start with SMACK Stack
Kick-Start with SMACK StackKick-Start with SMACK Stack
Kick-Start with SMACK StackKnoldus Inc.
 
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Anton Kirillov
 

Viewers also liked (8)

Webinar - How to Build Data Pipelines for Real-Time Applications with SMACK &...
Webinar - How to Build Data Pipelines for Real-Time Applications with SMACK &...Webinar - How to Build Data Pipelines for Real-Time Applications with SMACK &...
Webinar - How to Build Data Pipelines for Real-Time Applications with SMACK &...
 
Architecture Big Data open source S.M.A.C.K
Architecture Big Data open source S.M.A.C.KArchitecture Big Data open source S.M.A.C.K
Architecture Big Data open source S.M.A.C.K
 
Laying down the smack on your data pipelines
Laying down the smack on your data pipelinesLaying down the smack on your data pipelines
Laying down the smack on your data pipelines
 
SMACK Stack 1.1
SMACK Stack 1.1SMACK Stack 1.1
SMACK Stack 1.1
 
Streaming Analytics with Spark, Kafka, Cassandra and Akka by Helena Edelson
Streaming Analytics with Spark, Kafka, Cassandra and Akka by Helena EdelsonStreaming Analytics with Spark, Kafka, Cassandra and Akka by Helena Edelson
Streaming Analytics with Spark, Kafka, Cassandra and Akka by Helena Edelson
 
Data processing platforms with SMACK: Spark and Mesos internals
Data processing platforms with SMACK:  Spark and Mesos internalsData processing platforms with SMACK:  Spark and Mesos internals
Data processing platforms with SMACK: Spark and Mesos internals
 
Kick-Start with SMACK Stack
Kick-Start with SMACK StackKick-Start with SMACK Stack
Kick-Start with SMACK Stack
 
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
 

Similar to [若渴計畫2015.8.18] SMACK

申請 Let's Encrypt 免費 SSL 憑證一次就上手
申請 Let's Encrypt 免費 SSL 憑證一次就上手申請 Let's Encrypt 免費 SSL 憑證一次就上手
申請 Let's Encrypt 免費 SSL 憑證一次就上手Will Huang
 
Unix socket
Unix socketUnix socket
Unix socketst900278
 
網路技術心得分享
網路技術心得分享網路技術心得分享
網路技術心得分享Mux Baxer
 
20201006 meta_coin 六角學院
20201006 meta_coin 六角學院20201006 meta_coin 六角學院
20201006 meta_coin 六角學院Hu Kenneth
 
高性能并发网络服务器设计与实现
高性能并发网络服务器设计与实现高性能并发网络服务器设计与实现
高性能并发网络服务器设计与实现ideawu
 
Pki guide v1.0a_aka
Pki guide v1.0a_akaPki guide v1.0a_aka
Pki guide v1.0a_akaWASecurity
 
電腦網路 網路安全
電腦網路 網路安全電腦網路 網路安全
電腦網路 網路安全bruce761207
 
Internet Security
Internet SecurityInternet Security
Internet Securitybruce761207
 
Io t security-ameba-ppt
Io t security-ameba-pptIo t security-ameba-ppt
Io t security-ameba-pptJou Neo
 
區塊鏈創新基地 - 區塊鏈
區塊鏈創新基地 - 區塊鏈區塊鏈創新基地 - 區塊鏈
區塊鏈創新基地 - 區塊鏈Hu Kenneth
 
Hacking Nginx at Taobao
Hacking Nginx at TaobaoHacking Nginx at Taobao
Hacking Nginx at TaobaoJoshua Zhu
 
Ch6 ssh(2013 ncu-nos_nm)
Ch6   ssh(2013 ncu-nos_nm)Ch6   ssh(2013 ncu-nos_nm)
Ch6 ssh(2013 ncu-nos_nm)Kir Chou
 
构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接 构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接 Renaun Erickson
 
PKI Introduction / 公钥基础设施介绍
PKI Introduction / 公钥基础设施介绍PKI Introduction / 公钥基础设施介绍
PKI Introduction / 公钥基础设施介绍Zac John
 

Similar to [若渴計畫2015.8.18] SMACK (20)

A little ssl
A little sslA little ssl
A little ssl
 
申請 Let's Encrypt 免費 SSL 憑證一次就上手
申請 Let's Encrypt 免費 SSL 憑證一次就上手申請 Let's Encrypt 免費 SSL 憑證一次就上手
申請 Let's Encrypt 免費 SSL 憑證一次就上手
 
Unix socket
Unix socketUnix socket
Unix socket
 
網路技術心得分享
網路技術心得分享網路技術心得分享
網路技術心得分享
 
20201006 meta_coin 六角學院
20201006 meta_coin 六角學院20201006 meta_coin 六角學院
20201006 meta_coin 六角學院
 
Sse api
Sse apiSse api
Sse api
 
高性能并发网络服务器设计与实现
高性能并发网络服务器设计与实现高性能并发网络服务器设计与实现
高性能并发网络服务器设计与实现
 
Pki guide v1.0a_aka
Pki guide v1.0a_akaPki guide v1.0a_aka
Pki guide v1.0a_aka
 
Ssl
SslSsl
Ssl
 
電腦網路 網路安全
電腦網路 網路安全電腦網路 網路安全
電腦網路 網路安全
 
網路安全
網路安全網路安全
網路安全
 
Internet Security
Internet SecurityInternet Security
Internet Security
 
網路安全
網路安全網路安全
網路安全
 
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
 
Ch6 ssh(2013 ncu-nos_nm)
Ch6   ssh(2013 ncu-nos_nm)Ch6   ssh(2013 ncu-nos_nm)
Ch6 ssh(2013 ncu-nos_nm)
 
构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接 构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接
 
PKI Introduction / 公钥基础设施介绍
PKI Introduction / 公钥基础设施介绍PKI Introduction / 公钥基础设施介绍
PKI Introduction / 公钥基础设施介绍
 

More from Aj MaChInE

An Intro on Data-oriented Attacks
An Intro on Data-oriented AttacksAn Intro on Data-oriented Attacks
An Intro on Data-oriented AttacksAj MaChInE
 
A Study on .NET Framework for Red Team - Part I
A Study on .NET Framework for Red Team - Part IA Study on .NET Framework for Red Team - Part I
A Study on .NET Framework for Red Team - Part IAj MaChInE
 
A study on NetSpectre
A study on NetSpectreA study on NetSpectre
A study on NetSpectreAj MaChInE
 
Introduction to Adversary Evaluation Tools
Introduction to Adversary Evaluation ToolsIntroduction to Adversary Evaluation Tools
Introduction to Adversary Evaluation ToolsAj MaChInE
 
[若渴] A preliminary study on attacks against consensus in bitcoin
[若渴] A preliminary study on attacks against consensus in bitcoin[若渴] A preliminary study on attacks against consensus in bitcoin
[若渴] A preliminary study on attacks against consensus in bitcoinAj MaChInE
 
[RAT資安小聚] Study on Automatically Evading Malware Detection
[RAT資安小聚] Study on Automatically Evading Malware Detection[RAT資安小聚] Study on Automatically Evading Malware Detection
[RAT資安小聚] Study on Automatically Evading Malware DetectionAj MaChInE
 
[若渴] Preliminary Study on Design and Exploitation of Trustzone
[若渴] Preliminary Study on Design and Exploitation of Trustzone[若渴] Preliminary Study on Design and Exploitation of Trustzone
[若渴] Preliminary Study on Design and Exploitation of TrustzoneAj MaChInE
 
[若渴]Study on Side Channel Attacks and Countermeasures
[若渴]Study on Side Channel Attacks and Countermeasures [若渴]Study on Side Channel Attacks and Countermeasures
[若渴]Study on Side Channel Attacks and Countermeasures Aj MaChInE
 
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote ShellcodeAj MaChInE
 
[若渴計畫] Introduction: Formal Verification for Code
[若渴計畫] Introduction: Formal Verification for Code[若渴計畫] Introduction: Formal Verification for Code
[若渴計畫] Introduction: Formal Verification for CodeAj MaChInE
 
[若渴計畫] Studying ASLR^cache
[若渴計畫] Studying ASLR^cache[若渴計畫] Studying ASLR^cache
[若渴計畫] Studying ASLR^cacheAj MaChInE
 
[若渴計畫] Black Hat 2017之過去閱讀相關整理
[若渴計畫] Black Hat 2017之過去閱讀相關整理[若渴計畫] Black Hat 2017之過去閱讀相關整理
[若渴計畫] Black Hat 2017之過去閱讀相關整理Aj MaChInE
 

More from Aj MaChInE (12)

An Intro on Data-oriented Attacks
An Intro on Data-oriented AttacksAn Intro on Data-oriented Attacks
An Intro on Data-oriented Attacks
 
A Study on .NET Framework for Red Team - Part I
A Study on .NET Framework for Red Team - Part IA Study on .NET Framework for Red Team - Part I
A Study on .NET Framework for Red Team - Part I
 
A study on NetSpectre
A study on NetSpectreA study on NetSpectre
A study on NetSpectre
 
Introduction to Adversary Evaluation Tools
Introduction to Adversary Evaluation ToolsIntroduction to Adversary Evaluation Tools
Introduction to Adversary Evaluation Tools
 
[若渴] A preliminary study on attacks against consensus in bitcoin
[若渴] A preliminary study on attacks against consensus in bitcoin[若渴] A preliminary study on attacks against consensus in bitcoin
[若渴] A preliminary study on attacks against consensus in bitcoin
 
[RAT資安小聚] Study on Automatically Evading Malware Detection
[RAT資安小聚] Study on Automatically Evading Malware Detection[RAT資安小聚] Study on Automatically Evading Malware Detection
[RAT資安小聚] Study on Automatically Evading Malware Detection
 
[若渴] Preliminary Study on Design and Exploitation of Trustzone
[若渴] Preliminary Study on Design and Exploitation of Trustzone[若渴] Preliminary Study on Design and Exploitation of Trustzone
[若渴] Preliminary Study on Design and Exploitation of Trustzone
 
[若渴]Study on Side Channel Attacks and Countermeasures
[若渴]Study on Side Channel Attacks and Countermeasures [若渴]Study on Side Channel Attacks and Countermeasures
[若渴]Study on Side Channel Attacks and Countermeasures
 
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
 
[若渴計畫] Introduction: Formal Verification for Code
[若渴計畫] Introduction: Formal Verification for Code[若渴計畫] Introduction: Formal Verification for Code
[若渴計畫] Introduction: Formal Verification for Code
 
[若渴計畫] Studying ASLR^cache
[若渴計畫] Studying ASLR^cache[若渴計畫] Studying ASLR^cache
[若渴計畫] Studying ASLR^cache
 
[若渴計畫] Black Hat 2017之過去閱讀相關整理
[若渴計畫] Black Hat 2017之過去閱讀相關整理[若渴計畫] Black Hat 2017之過去閱讀相關整理
[若渴計畫] Black Hat 2017之過去閱讀相關整理
 

[若渴計畫2015.8.18] SMACK

Editor's Notes

  1. 憑證會給client ,serve傳public key給client。Client用 ca的public解出憑證內的server public key與 server傳的public key比對。
  2. 同步他們得狀態意思是 假設say hello結束代表client 和 server 都是停在Serverhello 並且知道要往哪裡進行。 Ciphersuite就是雙方都知道要用什麼方法來進行TLS協定的行為,舉例來說是用DH或者用RSA來做為key的交換機制 nonces對於產生client和server間通訊的secrete key有幫助。 為什麼叫state machine? 因為TLS會依據ciphersuite的參數設定而有不一樣的執行行為。
  3. 如果如我說的RSA這樣驗證 那幹嘛還要把ServerCertificates丟到client?
  4. Correct, illegal message正確接收到並執行對應正確的動作,client/server都知道有illegal message。 如果timeout/回傳不是表示正確,視為buggy。 因為有些可能不支援ciphersuites,就標示為unsupported。
  5. 當client看到certs 和 certs’s public key 就誤以為