SlideShare a Scribd company logo
ENCRYPTION
Security Mechanism:
Authentication
Authorization
Session Management
Data Validation
Error Handling
Logging
Encryption
Encryption Core Concepts
Do NOT attempt to create your
own encryption algorithms.
Encryption Choices
Hash Encryption One Way or Reversible?
(e.g., SHA-256 vs. AES)
Stream Cipher Block Cipher Bits vs. Blocks
(e.g., RC4 vs. AES)
Symmetric Asymmetric Shared vs. Public & Private Keys
(e.g., AES vs. RSA)
Stream Cipher
ECB CBC CTR … Which Mode to Use?ECB CTR
Encryption Words to Live By
 If storing passwords – hash with a salt value
 If you’re using authentication – encrypt data in transit
 Properly seed random number generators
Encryption Words to Live By: #1
 The problem
– The software uses a one-way cryptographic hash against an input
that should not be reversible, such as a password, but the software
does not also use a salt as part of the input.
If storing passwords – hash with a salt value
Real World Example – Hash Compromise
Remember the Anonymous attack discussed earlier?
Secure Coding …
 Multiple rounds of hashing (>1000)
 Use the latest available hashing algorithms (SHA-2)
 How to create salt?
– Create small random value
– The salt should be different for each user
– Can use a hash of the userid in some use cases
 Where to store salt?
– In the database with the userid/password
– Often pre-pended to the password in storage
 Preferred method
– Pbkdf: https://en.wikipedia.org/wiki/PBKDF2
Encryption Words to Live By: #2
 The problem
– Login pages not using adequate measures to protect the user name
and password while they are in transit from the client to the server.
– SSL (Secure Socket Layer) provides data confidentiality and
integrity to HTTP. By encrypting HTTP messages, SSL protects
from attackers eavesdropping or altering message contents.
If you’re using authentication – encrypt in transmission
Real World Example – Packet Capture
Real World Example - POODLE
 CBC encryption in SSL 3.0
– SSL has been around
for 18 years
 Block cipher padding is
not deterministic
– not covered by the MAC
 Man in the Middle
– control request
– padding fills an entire block
– reveals one byte at a time
Encryption is HARD!
POODLE = Padding Oracle On Downgraded Legacy Encryption
Encryption Words to Live By: #3
 The problem
– The software may use insufficiently random numbers or values in a
security context that depends on unpredictable numbers.
– When software generates predictable values in a context requiring
unpredictability, it may be possible for an attacker to guess the next
value that will be generated, and use this guess to impersonate
another user or access sensitive information.
Properly seed random number generators
Use of Random Numbers
 Symmetric keys and initialization vectors for block ciphers
 Session IDs
 Gambling games
– lotteries
– slot machines
 Statistical sampling
 Seed for a Pseudo Random Number Generator
Real World Example - Chip and Pin
 Many ATMs and point-of-sale
terminals use a predictable
random number
 Attack:
– attacker predicts “unpredictable
number” (UN)
– customer uses a controlled terminal
– "extra" transaction is performed
using the UN and a future date
– chip on credit card produces an
Authorization Request Cryptogram
(ARQC) based on UN
– when time is right, attacker uses
fake card with pre-recorded ARQC
at ATM to withdraw cash
Secure Coding …
 Pitfalls
– Use of predictable random number generators
 C: rand()
 Java: java.util.Random()
– Forgetting to seed the random number generator -or- Using the
same seed every time
 will generate identical sequences of numbers
 Java.Security.SecureRandom
– (typically) uses the SHA1PRNG generator
– seeds itself using /dev/urandom
 collects random data from disk reads, mouse movement, keystrokes, etc.
– be careful overriding the PRNG or seed, make sure you know what
you are doing

More Related Content

PPTX
Brute force attack
PDF
Encryption Deep Dive
PPT
PDF
Stu r33 b (2)
PPSX
Brute force attack
PDF
A Survey of Password Attacks and Safe Hashing Algorithms
PPTX
P@ssw0rds
PDF
Cryptography
Brute force attack
Encryption Deep Dive
Stu r33 b (2)
Brute force attack
A Survey of Password Attacks and Safe Hashing Algorithms
P@ssw0rds
Cryptography

Similar to 10 application security fundamentals - part 2 - security mechanisms - encryption (20)

PPTX
Using Cryptography Properly in Applications
PDF
Cryptography for Penetration Testers (PDF version)
PDF
Cryptography For The Average Developer
PDF
Cryptography For The Average Developer - Sunshine PHP
PPTX
How to Use Cryptography Properly: Common Mistakes People Make When Using Cry...
PDF
When Crypto Attacks! (Yahoo 2009)
PDF
Sp W12
PPT
6. cryptography
PPT
14_526_topic07uuuuuuuuuuuuuuuuuuuuuu.ppt
PPT
amer-network-sihubconferances-security.ppt
PPT
OWASP Much ado about randomness
PDF
A Robust Cryptographic System using Neighborhood-Generated Keys
PDF
A Robust Cryptographic System using Neighborhood-Generated Keys
PPT
Cryptography
ODP
All Your Password Are Belong To Us
PPTX
FYP1 Presentation
PDF
Securing Database Passwords Using a Combination of hashing and Salting Techni...
PPT
introduction to cryptography
PDF
Intro to Cryptography
PPTX
501 ch 10 cryptography
Using Cryptography Properly in Applications
Cryptography for Penetration Testers (PDF version)
Cryptography For The Average Developer
Cryptography For The Average Developer - Sunshine PHP
How to Use Cryptography Properly: Common Mistakes People Make When Using Cry...
When Crypto Attacks! (Yahoo 2009)
Sp W12
6. cryptography
14_526_topic07uuuuuuuuuuuuuuuuuuuuuu.ppt
amer-network-sihubconferances-security.ppt
OWASP Much ado about randomness
A Robust Cryptographic System using Neighborhood-Generated Keys
A Robust Cryptographic System using Neighborhood-Generated Keys
Cryptography
All Your Password Are Belong To Us
FYP1 Presentation
Securing Database Passwords Using a Combination of hashing and Salting Techni...
introduction to cryptography
Intro to Cryptography
501 ch 10 cryptography
Ad

More from appsec (12)

PPTX
23 owasp top 10 - resources
PPTX
15 owasp top 10 - a3-xss
PPTX
12 owasp top 10 - introduction
PPTX
11 application security fundamentals - part 2 - security mechanisms - summary
PPTX
09 application security fundamentals - part 2 - security mechanisms - logging
PPTX
08 application security fundamentals - part 2 - security mechanisms - error...
PPTX
06 application security fundamentals - part 2 - security mechanisms - sessi...
PPTX
07 application security fundamentals - part 2 - security mechanisms - data ...
PPTX
04 application security fundamentals - part 2 - security mechanisms - authe...
PPTX
05 application security fundamentals - part 2 - security mechanisms - autho...
PPTX
02 application security fundamentals - part 1 - security priciples
PPTX
01 Application Security Fundamentals - part 1 - introduction and goals
23 owasp top 10 - resources
15 owasp top 10 - a3-xss
12 owasp top 10 - introduction
11 application security fundamentals - part 2 - security mechanisms - summary
09 application security fundamentals - part 2 - security mechanisms - logging
08 application security fundamentals - part 2 - security mechanisms - error...
06 application security fundamentals - part 2 - security mechanisms - sessi...
07 application security fundamentals - part 2 - security mechanisms - data ...
04 application security fundamentals - part 2 - security mechanisms - authe...
05 application security fundamentals - part 2 - security mechanisms - autho...
02 application security fundamentals - part 1 - security priciples
01 Application Security Fundamentals - part 1 - introduction and goals
Ad

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
sap open course for s4hana steps from ECC to s4
PDF
cuic standard and advanced reporting.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Cloud computing and distributed systems.
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Electronic commerce courselecture one. Pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Unlocking AI with Model Context Protocol (MCP)
The AUB Centre for AI in Media Proposal.docx
NewMind AI Weekly Chronicles - August'25 Week I
sap open course for s4hana steps from ECC to s4
cuic standard and advanced reporting.pdf
Network Security Unit 5.pdf for BCA BBA.
Mobile App Security Testing_ A Comprehensive Guide.pdf
Understanding_Digital_Forensics_Presentation.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Cloud computing and distributed systems.
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Electronic commerce courselecture one. Pdf
Spectral efficient network and resource selection model in 5G networks
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MYSQL Presentation for SQL database connectivity
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Unlocking AI with Model Context Protocol (MCP)

10 application security fundamentals - part 2 - security mechanisms - encryption

  • 2. Encryption Core Concepts Do NOT attempt to create your own encryption algorithms. Encryption Choices Hash Encryption One Way or Reversible? (e.g., SHA-256 vs. AES) Stream Cipher Block Cipher Bits vs. Blocks (e.g., RC4 vs. AES) Symmetric Asymmetric Shared vs. Public & Private Keys (e.g., AES vs. RSA) Stream Cipher ECB CBC CTR … Which Mode to Use?ECB CTR
  • 3. Encryption Words to Live By  If storing passwords – hash with a salt value  If you’re using authentication – encrypt data in transit  Properly seed random number generators
  • 4. Encryption Words to Live By: #1  The problem – The software uses a one-way cryptographic hash against an input that should not be reversible, such as a password, but the software does not also use a salt as part of the input. If storing passwords – hash with a salt value
  • 5. Real World Example – Hash Compromise Remember the Anonymous attack discussed earlier?
  • 6. Secure Coding …  Multiple rounds of hashing (>1000)  Use the latest available hashing algorithms (SHA-2)  How to create salt? – Create small random value – The salt should be different for each user – Can use a hash of the userid in some use cases  Where to store salt? – In the database with the userid/password – Often pre-pended to the password in storage  Preferred method – Pbkdf: https://en.wikipedia.org/wiki/PBKDF2
  • 7. Encryption Words to Live By: #2  The problem – Login pages not using adequate measures to protect the user name and password while they are in transit from the client to the server. – SSL (Secure Socket Layer) provides data confidentiality and integrity to HTTP. By encrypting HTTP messages, SSL protects from attackers eavesdropping or altering message contents. If you’re using authentication – encrypt in transmission
  • 8. Real World Example – Packet Capture
  • 9. Real World Example - POODLE  CBC encryption in SSL 3.0 – SSL has been around for 18 years  Block cipher padding is not deterministic – not covered by the MAC  Man in the Middle – control request – padding fills an entire block – reveals one byte at a time Encryption is HARD! POODLE = Padding Oracle On Downgraded Legacy Encryption
  • 10. Encryption Words to Live By: #3  The problem – The software may use insufficiently random numbers or values in a security context that depends on unpredictable numbers. – When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information. Properly seed random number generators
  • 11. Use of Random Numbers  Symmetric keys and initialization vectors for block ciphers  Session IDs  Gambling games – lotteries – slot machines  Statistical sampling  Seed for a Pseudo Random Number Generator
  • 12. Real World Example - Chip and Pin  Many ATMs and point-of-sale terminals use a predictable random number  Attack: – attacker predicts “unpredictable number” (UN) – customer uses a controlled terminal – "extra" transaction is performed using the UN and a future date – chip on credit card produces an Authorization Request Cryptogram (ARQC) based on UN – when time is right, attacker uses fake card with pre-recorded ARQC at ATM to withdraw cash
  • 13. Secure Coding …  Pitfalls – Use of predictable random number generators  C: rand()  Java: java.util.Random() – Forgetting to seed the random number generator -or- Using the same seed every time  will generate identical sequences of numbers  Java.Security.SecureRandom – (typically) uses the SHA1PRNG generator – seeds itself using /dev/urandom  collects random data from disk reads, mouse movement, keystrokes, etc. – be careful overriding the PRNG or seed, make sure you know what you are doing