T1921

Ladda ner som PDF

Desktop application security in Java

Your application written in Java works as intended, so you are done, right? But did you consider feeding in incorrect values? 16Gbs of data? A null? An apostrophe? Negative numbers, or specifically -232? Because that’s what the bad guys will do – and the list is far from complete.

Handling security needs a healthy level of paranoia, and this is what this course provides: a strong emotional engagement by lots of hand on labs and stories from real life, all to substantially improve code hygiene. Mistakes, consequences and best practices are our blood, sweat and tears.

So that you are prepared for the forces of the dark side.

Nothing.

Audience

Java developers working on desktop applications

Prior knowledge

General Java development

Objectives

  • Handling security challenges in your Java code
  • Identify vulnerabilities and their consequences
  • Learn the security best practices in Java

Outline

  • Cybersecurity basics
  • Input validation
  • Using vulnerable components
  • Security features
  • Common software security weaknesses
  • Wrap up

Day 1

Cybersecurity basics

* What is security?

* Threat and risk
* Cybersecurity threat types
* Consequences of insecure software
* Constraints and the market
* The dark side
* Motivation and intent
* Categorization of bugs
  - The Seven Pernicious Kingdoms
  - Common Weakness Enumeration (CWE)
  - CWE/SANS Top 25 Most Dangerous Software Errors
  - SEI Cert Secure Coding Guidelines
  - Vulnerabilities in the environment and dependencies

Input validation

*Input validation principles

  - Blacklists and whitelists
  - Data validation techniques
  - What to validate – the attack surface
  - When to validate – validation vs transformations
  - Where to validate – defense in depth
  - Output sanitization
  - Encoding challenges
  - Validation with regex

*Injection
  - Injection principles
  - Injection attacks
  - CRLF injection
    - Log forging
    - Lab – Log forging
    - Log forging – best practices
  - Code injection
  - OS command injection
 ... Läs mer

Objectives

  • Handling security challenges in your Java code
  • Identify vulnerabilities and their consequences
  • Learn the security best practices in Java

Outline

  • Cybersecurity basics
  • Input validation
  • Using vulnerable components
  • Security features
  • Common software security weaknesses
  • Wrap up

Day 1

Cybersecurity basics

* What is security?

* Threat and risk
* Cybersecurity threat types
* Consequences of insecure software
* Constraints and the market
* The dark side
* Motivation and intent
* Categorization of bugs
  - The Seven Pernicious Kingdoms
  - Common Weakness Enumeration (CWE)
  - CWE/SANS Top 25 Most Dangerous Software Errors
  - SEI Cert Secure Coding Guidelines
  - Vulnerabilities in the environment and dependencies

Input validation

*Input validation principles

  - Blacklists and whitelists
  - Data validation techniques
  - What to validate – the attack surface
  - When to validate – validation vs transformations
  - Where to validate – defense in depth
  - Output sanitization
  - Encoding challenges
  - Validation with regex

*Injection
  - Injection principles
  - Injection attacks
  - CRLF injection
    - Log forging
    - Lab – Log forging
    - Log forging – best practices
  - Code injection
  - OS command injection
    - OS command injection best practices
    - Using Runtime.exec()
    - Using ProcessBuilder
    - Case study – Shellshock
    - Lab – Shellshock
    - Case study – Command injection via ping
    - Script injection
    - Injection best practices

*Integer handling problems
  - Representing signed numbers
  - Integer visualization
  - Integer overflow
  - Lab – Integer overflow
  - Signed / unsigned confusion in Java
  - Integer truncation
  - Best practices
    - Upcasting
    - Precondition testing
    - Postcondition testing
    - Using big integer libraries
    - Integer handling in Java
    - Lab – Integer handling
  - Other numeric problems
    - Division by zero
    - Working with floating-point numbers
  - Containers
    - Security issues with containers and unused elements
    - Associative containers

*Files and streams
  - Path traversal
  - Path traversal-related examples
  - Lab – Path traversal
  - Additional challenges in Windows
  - Virtual resources
  - Path traversal best practices

*Unsafe reflection
  - Reflection without validation
    - Lab – Unsafe reflection

*Unsafe native code
  - Native code dependence
  - Lab – Unsafe JNI
  - Best practices for dealing with native code

Using vulnerable components

*Assessing the environment

  - Hardening
  - Untrusted functionality import
  - Case study – The Equifax data breach
  - Vulnerability management
    - Patch management
    - Vulnerability databases and scanning tools
    - Lab – Searching for vulnerabilities in the used components

Day 2

Security features

*Authentication
  - Authentication basics
  - Authentication weaknesses
  - Case study – Equifax Argentina
  - Case study – PayPal 2FA bypass
  - User interface best practices
  - Password management
    - Inbound password management
    - Storing account passwords
    - Password in transit
    - Lab – Why is just hashing passwords not enough?
    - Dictionary attacks and brute forcing
    - Salting
    - Adaptive hash functions for password storage
    - (Mis)handling null passwords
    - Password policy
      - NIST authenticator requirements for memorized secrets
      - Password length
      - Password hardening
      - Using passphrases
      - Lab – Applying a password policy
    - The Ashley Madison data breach
      - The dictionary attack
      - The ultimate crack
      - Exploitation and the lessons learned
    - Password database migration
  - Outbound password management
    - Hard coded passwords
    - Best practices
    - Lab – Hardcoded password
    - Protecting sensitive information in memory
      - Challenges in protecting memory
      - Storing sensitive data in memory

*Authorization
  - Access control basics
  - Access control in databases
  - Privileges and permissions
    - Permission manipulation
    - Case study – The Capital One breach
    - Incorrect use of privileged APIs
    - Permission best practices
      - Principle of least privilege
      - Principle of separation of privilege
      - Permission granting and handling

*Java platform security
  - The Java programming language and runtime environment
  - Type safety and security
  - Security features of the JRE
    - The ClassLoader and the BytecodeVerifier
  - Application-level access control in Java
    - Permissions and the Security Manager
    - Privilege best practices
  - Role-based access control
      - Java Authentication and Authorization Services (JAAS)
    - Protecting Java code and applications
      - Code signing
      - Lab – Code signing and permissions

*Information exposure
  - Exposure through extracted data and aggregation
  - Case study – Strava fitness app data exposure
  - Data exposure best practices
  - Data masking
  - System information leakage
    - Leaking system information
  - Information exposure best practices

*UI security
  - UI security principles
  - Sensitive information in the user interface
  - Misinterpretation of UI features or actions
  - Insufficient UI feedback
  - Relying on hidden or disabled UI element
  - Insufficient anti-automation

Day 3

Common software security weaknesses

*Time and state
  - Race conditions
    - Race condition in object data members
      - Singleton member fields
      - Lab – Singleton member fields
    - File race condition
      - Insecure temporary file
    - Database race conditions
      - Lab – Database race conditions
    - Avoiding race conditions in Java

*Errors
  - Error and exception handling principles
  - Error handling
    - Returning a misleading status code
    - Reachable assertion
      - Information exposure through error reporting
  - Exception handling
    - In the catch block. And now what?
    - Catching NullPointerException
    - Empty catch block
    - Overly broad throws
    - Improper completing of the finally block
    - Throwing undeclared checked exceptions
    - Swallowed ThreadDeath
    - Throwing RuntimeException, Exception, or Throwable
    - Lab – Exception handling mess

*Code quality
  - Constructors and destructors
  - Class initialization cycles
  - Lab – Initialization cycles
  - Unreleased resource
  - The finalize() method – best practices
  - Object oriented programming pitfalls
    - Relying on accessibility modifiers
    - Accessibility modifiers
    - Overriding and accessibility modifiers
    - Inheritance and overriding
    - Implementing equals()
    - Mutability
      - Lab – Mutable object
    - Cloning

*Denial of service
  - Denial of Service
  - Resource exhaustion
  - Cash overflow
  - Flooding
  - Sustained client engagement
  - Denial of service problems in Java
  - Infinite loop
  - Lab – Resource exhausting
  - Amplification
    - Network amplification
    - Amplification in databases
    - Other amplification examples
  - Algorithm complexity issues
  - Regular expression denial of service (ReDoS)
    - Lab – ReDos
  - Hashtable collision
    - How hashtables work?
    - Hash collision in case of hashtables
    - Hashtable collision in Java

*Wrap up
  - Secure coding principles
  - Principles of robust programming by Matt Bishop
  - Secure design principles of Saltzer and Schröder
  - Some more principles

*And now what?
  - Further sources and readings
  - Java resources

Utbildningen levereras i samarbete med

Kursfakta

Kurs-ID: T1921
Längd: 3 dagar
Pris exkl moms: 28 000 kr
Inregistrering: 09.00
Kursstart: 09.30
Kursslut (ca): 17.00

Frågor om kursen?

Har du frågor om kursens innehåll, leveransdatum/ort eller behöver en företagsanpassad variant? Fyll i formuläret nedan!


Kan betalas med:
TRAINING CARD

Ort och datum

Stockholm
25 nov-27 nov
Boka nu!
2 mar-4 mar
Boka nu!
4 maj-6 maj
Boka nu!
Göteborg
25 nov-27 nov
R
Boka nu!
2 mar-4 mar
R
Boka nu!
4 maj-6 maj
R
Boka nu!
Cloud Access
i Läs mer

Delta på kursen från ditt hem, jobb eller annan plats.

25 nov-27 nov
Boka nu!
2 mar-4 mar
Boka nu!
4 maj-6 maj
Boka nu!

Tipsa