SlideShare a Scribd company logo
Denis Kolegov, Nikita Oleksov, Oleg Broslavsky
Tomsk State University
Information Security and Cryptography Department
White-Box HMAC
Make your cryptography secure to white-box attacks
May 17-18, Moscow
Attacker is assumed to have:
Zero visibility on code during
execution
External information, such as plaintext
or ciphertext
Considered secure as long as the
cipher has no cryptographic
weaknesses
2
Attacker is assumed to have:
Partial physical access to the
cryptographic key as a result of the
cipher leaking side-channel
information
 Electromagnetic radiation analysis
 Current/power consumption analysis
 Operation timing analysis
3
Attacker is assumed to have:
Full visibility — inputs, outputs,
memory (using debuggers), and
intermediate calculations
Access to the algorithms while
watching how they are carried out
Traditional cryptography is not secure
when running in a white-box model
4
Digital Rights Management Systems
 The end-user is then able to purchase some
type of premium content (e.g., new GoT
season)
 The content arrives at the user’s device
encrypted, and is decrypted by the software
as it is viewed
 A malicious end-user may attempt to extract
cryptographic keys from the software and
then use them to redistribute content outside
the DRM system
5
Client-side web application
 Web application forms some client-side
queries to the backend
 A malicious user may attempt to form
malicious queries and exploit some backend
vulnerabilities
Common case W/ white-box crypto in JS 6
Generate for every key a fixed
implementation, that will contain
hard-coded key
Hide hardcoded key so,
that encrypt and decrypt
operations maintain sensitive
data without revealing any
portions of the key
Make the key extraction difficult
or even impracticable
7
The Advanced Encryption Standard (AES) is a specification for the encryption of
electronic data established by the U.S. National Institute of Standards and
Technology (NIST) 8
9
The Advanced Encryption Standard (AES) is a specification for the encryptionof
electronic data established by the U.S. National Institute of Standards and
Technology (NIST) 10
All that functions could
be easily implemented
using substitution tables
11
Long story short…
More information can be found in §4
of A Tutorial on White-box AES
by James Muir
For more security Chow
suggest to apply to the
state in every round
invertible mixing
bijections and external
encodings
12
Client-side web application.
 Web application forms some client-side
queries to the backend
 A malicious user may attempt to form
malicious queries and exploit some backend
vulnerabilities
Common case W/ white-box crypto in JS
We need
keyed-hashes!
13
2 common ways to build a keyed-hash
Use a block cipher Use HMAC scheme
 Easy to use: just turn on
CBC-MAC mode
 Mb slower than pure hash
 Possibly short block size
 Easy to compute
 Lots of possible hashes
 Fast
14
HMACK(m) = hash[(K ⊕ opad) || h(K ⊕ ipad || m)]
Construction scheme:
Common hash calculation scheme:
15
Each round of hash changes inner hash variables. Saving its’
states give us a possibility to continue hash calculations
>>> import md5
>>> m =md5.new()
>>> m.update("Nobody inspects")
>>> m.update(" the spammish repetition")
>>> m.digest()
'xbbdx9cx83xddx1exa5xc9xd9xdexc9xa1x8dxf0xffxe9‘
>>> md5.new("Nobody inspects the spammish repetition").digest()
'xbbdx9cx83xddx1exa5xc9xd9xdexc9xa1x8dxf0xffxe9'
Gives the same as
16
Both keyed parts are
located at the first
hash block
HMACK(m) = h [(K ⊕ opad) || h(K ⊕ ipad || m)]
17
HMACK(m) = h [(K ⊕ opad) || h(K ⊕ ipad || m)]
IV f
K ⊕ opad
SO IV f
K ⊕ ipad
Si
Save inner states of hashing algorithm after the first block for
the key padded with opad and with ipad
18
Si f
m
So f
h(K ⊕ ipad || m)
hmac
HMACK(m) = h [(K ⊕ opad) || h(K ⊕ ipad || m)]
Common hash-
function realization
Hard-coded states
used as IV
19
Implementation of such white-box HMAC scheme using any cryptographic of
hash function requires only minimal changes in hash function code and no
changes in the common template
20
Si
So
https://github.com/tsu-iscd/jcrypto
Implementation of White-box AES128-CTR and HMAC-SHA256
in JavaScript language
 RFC 4231 test vectors
 NIST test vectors
 Another custom tests (e.g. jsSHA test vectors)
21
Oleg Broslavsky
ovbroslavsky@gmail.com
@yalegko
Nikita Oleksov
neoleksov@gmail.com
@NEOleksov
22
Denis Kolegov
dnkolegov@gmail.com
@dnkolegov

More Related Content

DOCX
AYUSH.docx
PDF
White box cryptography
PDF
White-box Cryptography -BayThreat 2013
PPTX
ИИ: Этические аспекты проблемы выбора
PDF
Hide and seek - interesting uses of forensics and covert channels.
PDF
How to admin
PDF
How to Open School For Young Hackers
PPTX
AOP and Inversion of Conrol
AYUSH.docx
White box cryptography
White-box Cryptography -BayThreat 2013
ИИ: Этические аспекты проблемы выбора
Hide and seek - interesting uses of forensics and covert channels.
How to admin
How to Open School For Young Hackers
AOP and Inversion of Conrol

Similar to White-Box HMAC. Make your cipher secure to white-box attacks. (20)

PPTX
White box crytography in an insecure enviroment
PPT
CS283_hash.ppt
PPT
needed.ppt
PPT
introduction to cryptography (basics of it)
PPT
crypto1.ppt
PPT
crypto.ppt
PDF
Applied cryptanalysis - everything else
PPT
Hash mac algorithms
PPT
Hash mac algorithms
PPT
Hash mac algorithms
PPT
Hash mac algorithms
PPT
Hash& mac algorithms
PPT
Hash mac algorithms
PPT
Hash mac algorithms
PPT
HMAC&CMAC.ppt
PPT
ch12.ppt
PPT
Distribution of public keys and hmac
PDF
cryptography summary hash function slides
PPT
introduction to cryptography
PPTX
Message Digest message digest ppttsx.pptx
White box crytography in an insecure enviroment
CS283_hash.ppt
needed.ppt
introduction to cryptography (basics of it)
crypto1.ppt
crypto.ppt
Applied cryptanalysis - everything else
Hash mac algorithms
Hash mac algorithms
Hash mac algorithms
Hash mac algorithms
Hash& mac algorithms
Hash mac algorithms
Hash mac algorithms
HMAC&CMAC.ppt
ch12.ppt
Distribution of public keys and hmac
cryptography summary hash function slides
introduction to cryptography
Message Digest message digest ppttsx.pptx
Ad

More from yalegko (9)

PDF
SD-WAN Internet Census
PDF
So Your WAF Needs a Parser
PDF
WebGoat.SDWAN.Net in Depth
PDF
[ISC] Docker + Swarm
PDF
How to make school CTF
PPTX
Covert timing channels using HTTP cache headers
PPTX
Covert timing channels using HTTP cache headers
PPTX
Include and extend in Ruby
PPTX
Not a children in da web
SD-WAN Internet Census
So Your WAF Needs a Parser
WebGoat.SDWAN.Net in Depth
[ISC] Docker + Swarm
How to make school CTF
Covert timing channels using HTTP cache headers
Covert timing channels using HTTP cache headers
Include and extend in Ruby
Not a children in da web
Ad

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Approach and Philosophy of On baking technology
PPT
Teaching material agriculture food technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Encapsulation theory and applications.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Cloud computing and distributed systems.
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Machine learning based COVID-19 study performance prediction
PDF
cuic standard and advanced reporting.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Approach and Philosophy of On baking technology
Teaching material agriculture food technology
Chapter 3 Spatial Domain Image Processing.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Unlocking AI with Model Context Protocol (MCP)
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Encapsulation theory and applications.pdf
MIND Revenue Release Quarter 2 2025 Press Release
MYSQL Presentation for SQL database connectivity
sap open course for s4hana steps from ECC to s4
Cloud computing and distributed systems.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Big Data Technologies - Introduction.pptx
20250228 LYD VKU AI Blended-Learning.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf

White-Box HMAC. Make your cipher secure to white-box attacks.

  • 1. Denis Kolegov, Nikita Oleksov, Oleg Broslavsky Tomsk State University Information Security and Cryptography Department White-Box HMAC Make your cryptography secure to white-box attacks May 17-18, Moscow
  • 2. Attacker is assumed to have: Zero visibility on code during execution External information, such as plaintext or ciphertext Considered secure as long as the cipher has no cryptographic weaknesses 2
  • 3. Attacker is assumed to have: Partial physical access to the cryptographic key as a result of the cipher leaking side-channel information  Electromagnetic radiation analysis  Current/power consumption analysis  Operation timing analysis 3
  • 4. Attacker is assumed to have: Full visibility — inputs, outputs, memory (using debuggers), and intermediate calculations Access to the algorithms while watching how they are carried out Traditional cryptography is not secure when running in a white-box model 4
  • 5. Digital Rights Management Systems  The end-user is then able to purchase some type of premium content (e.g., new GoT season)  The content arrives at the user’s device encrypted, and is decrypted by the software as it is viewed  A malicious end-user may attempt to extract cryptographic keys from the software and then use them to redistribute content outside the DRM system 5
  • 6. Client-side web application  Web application forms some client-side queries to the backend  A malicious user may attempt to form malicious queries and exploit some backend vulnerabilities Common case W/ white-box crypto in JS 6
  • 7. Generate for every key a fixed implementation, that will contain hard-coded key Hide hardcoded key so, that encrypt and decrypt operations maintain sensitive data without revealing any portions of the key Make the key extraction difficult or even impracticable 7
  • 8. The Advanced Encryption Standard (AES) is a specification for the encryption of electronic data established by the U.S. National Institute of Standards and Technology (NIST) 8
  • 9. 9
  • 10. The Advanced Encryption Standard (AES) is a specification for the encryptionof electronic data established by the U.S. National Institute of Standards and Technology (NIST) 10 All that functions could be easily implemented using substitution tables
  • 12. More information can be found in §4 of A Tutorial on White-box AES by James Muir For more security Chow suggest to apply to the state in every round invertible mixing bijections and external encodings 12
  • 13. Client-side web application.  Web application forms some client-side queries to the backend  A malicious user may attempt to form malicious queries and exploit some backend vulnerabilities Common case W/ white-box crypto in JS We need keyed-hashes! 13
  • 14. 2 common ways to build a keyed-hash Use a block cipher Use HMAC scheme  Easy to use: just turn on CBC-MAC mode  Mb slower than pure hash  Possibly short block size  Easy to compute  Lots of possible hashes  Fast 14
  • 15. HMACK(m) = hash[(K ⊕ opad) || h(K ⊕ ipad || m)] Construction scheme: Common hash calculation scheme: 15
  • 16. Each round of hash changes inner hash variables. Saving its’ states give us a possibility to continue hash calculations >>> import md5 >>> m =md5.new() >>> m.update("Nobody inspects") >>> m.update(" the spammish repetition") >>> m.digest() 'xbbdx9cx83xddx1exa5xc9xd9xdexc9xa1x8dxf0xffxe9‘ >>> md5.new("Nobody inspects the spammish repetition").digest() 'xbbdx9cx83xddx1exa5xc9xd9xdexc9xa1x8dxf0xffxe9' Gives the same as 16
  • 17. Both keyed parts are located at the first hash block HMACK(m) = h [(K ⊕ opad) || h(K ⊕ ipad || m)] 17
  • 18. HMACK(m) = h [(K ⊕ opad) || h(K ⊕ ipad || m)] IV f K ⊕ opad SO IV f K ⊕ ipad Si Save inner states of hashing algorithm after the first block for the key padded with opad and with ipad 18
  • 19. Si f m So f h(K ⊕ ipad || m) hmac HMACK(m) = h [(K ⊕ opad) || h(K ⊕ ipad || m)] Common hash- function realization Hard-coded states used as IV 19
  • 20. Implementation of such white-box HMAC scheme using any cryptographic of hash function requires only minimal changes in hash function code and no changes in the common template 20 Si So
  • 21. https://github.com/tsu-iscd/jcrypto Implementation of White-box AES128-CTR and HMAC-SHA256 in JavaScript language  RFC 4231 test vectors  NIST test vectors  Another custom tests (e.g. jsSHA test vectors) 21