T1842

Ladda ner som PDF

Python Security

This course covers the most critical security issues in Python applications. We cover vulnerabilities from the OWASP Top Ten list for the web as they concern Python web applications as well as the Django framework.

The course also encompasses the most significant security issues for Python code in general (including many Python-specific issues such as function hijacking), while also presenting security solutions provided by the Python ecosystem – such as authentication, access control and encryption

Audience

Coders using Python who need to deliver secure solutions

Prior knowledge

General Python development

Courseware

Hands-on excercises

Background

The Python language is used in many different settings – from command-line tools to complex Web applications. Many of these Python programs are exposed to attack, either by being directly accessible through the Internet or by directly processing user-provided data in a server environment. Developers must therefore be extremely cautious in how to use different technologies securely, and should also have a deep understanding in secure coding techniques and potential pitfalls.

Understanding the security solutions provided by Python as well as the various security issues and vulnerabilities is a must for all programmers using these technologies to develop web, desktop or server applications.

COURSE OUTLINE

  • IT security and secure coding
  • Web application security (OWASP Top Ten 2017)
  • Client-side security
  • Python security architecture
  • Practical cryptography
  • Common coding errors and vulnerabilities
  • Denial of service
  • Principles of security and secure coding
  • Knowledge sources

PARTICIPANTS ATTENDING WILL

  • Understand basic concepts of security, IT security and secure coding
  • Learn Web vulnerabilities beyond OWASP Top Ten and know how to avoid them
  • Learn about XML security
  • Learn client-side vulnerabilities and secure coding practices
  • Learn about Python security architecture
  • Have a practical understanding of cryptography
  • Learn about typical coding... Läs mer

Background

The Python language is used in many different settings – from command-line tools to complex Web applications. Many of these Python programs are exposed to attack, either by being directly accessible through the Internet or by directly processing user-provided data in a server environment. Developers must therefore be extremely cautious in how to use different technologies securely, and should also have a deep understanding in secure coding techniques and potential pitfalls.

Understanding the security solutions provided by Python as well as the various security issues and vulnerabilities is a must for all programmers using these technologies to develop web, desktop or server applications.

COURSE OUTLINE

  • IT security and secure coding
  • Web application security (OWASP Top Ten 2017)
  • Client-side security
  • Python security architecture
  • Practical cryptography
  • Common coding errors and vulnerabilities
  • Denial of service
  • Principles of security and secure coding
  • Knowledge sources

PARTICIPANTS ATTENDING WILL

  • Understand basic concepts of security, IT security and secure coding
  • Learn Web vulnerabilities beyond OWASP Top Ten and know how to avoid them
  • Learn about XML security
  • Learn client-side vulnerabilities and secure coding practices
  • Learn about Python security architecture
  • Have a practical understanding of cryptography
  • Learn about typical coding mistakes and how to avoid them
  • Get information about some recent vulnerabilities in the Java framework
  • Learn about denial of service attacks and protections
  • Get sources and further readings on secure coding practice
  • Day 1

    • IT security and secure coding
      • Nature of security
      • What is risk?
      • IT security vs. secure coding
      • From vulnerabilities to botnets and cybercrime
        • Nature of security flaws
        • Reasons of difficulty
        • From an infected computer to targeted attacks
        • The Seven Pernicious Kingdoms
        • OWASP Top Ten 2017
    • Web application security (OWASP Top Ten 2017)
      • A1 - Injection
        • Injection principles
        • SQL injection
          • Exercise – SQL injection
          • Typical SQL Injection attack methods
          • Blind and time-based SQL injection
          • SQL injection protection methods
          • Database access in Python
          • ORM libraries in Python
        • Other injection flaws
          • Command injection
          • Command injection exercise – starting Netcat
          • Case study – ImageMagick
      • A2 - Broken authentication
        • Session handling threats
        • Session handling best practices
        • Sessions in Django
        • Additional cookie security considerations
        • Setting cookie attributes – best practices
      • A3 - Sensitive data exposure
        • Sensitive data exposure
        • Transport layer security
          • HTTPS in Django
      • A4 - XML external entity (XXE)
        • XML Entity introduction
        • XML external entity attack (XXE) – resource inclusion
        • XML external entity attack – URL invocation
        • XML external entity attack – parameter entities
        • Exercise – XXE attack
        • Preventing entity-related attacks
        • Case study – XXE in Google Toolbar
      • A5 - Broken access control
        • Typical access control weaknesses
        • Insecure direct object reference (IDOR)
        • Exercise – Insecure direct object reference
        • Protection against IDOR
        • Case study – Facebook Notes
      • A7 - Cross-Site Scripting (XSS)
        • Persistent XSS
        • Reflected XSS
        • DOM-based XSS
        • Exercise – Cross Site Scripting
        • XSS prevention
      • A8 - Insecure deserialization
        • Deserialization basics
        • Security challenges of deserialization
        • Security issues when using Pickle
        • Code injection via overriding __reduce__ in Pickle
        • Code injection via YAML deserialization
        • Issues with deserialization – JSON
      • A9 - Using components with known vulnerabilities
  • Day 2

    • Client-side security
      • JavaScript security
      • Same Origin Policy
      • Cross Origin Resource Sharing (CORS)
      • JavaScript usage
      • JavaScript Global Object
      • Dangers of JavaScript
      • Exercise – Client-side authentication
      • Client-side authentication and password management
      • Protecting JavaScript code
      • Exercise – JavaScript obfuscation
      • Clickjacking
        • Clickjacking
        • Exercise – Do you Like me?
        • Protection against Clickjacking
        • Anti frame-busting – dismissing protection scripts
        • Protection against busting frame busting
      • AJAX security
        • XSS in AJAX
        • Script injection attack in AJAX
        • Exercise – XSS in AJAX
        • XSS protection in Ajax
        • Exercise CSRF in AJAX – JavaScript hijacking
        • CSRF protection in AJAX
      • HTML5 security
        • New XSS possibilities in HTML5
        • HTML5 clickjacking attack – text field injection
        • HTML5 clickjacking – content extraction
        • Form tampering
        • Exercise – Form tampering
        • Cross-origin requests
        • HTML proxy with cross-origin request
        • Exercise – Client side include
    • Python security architecture
      • Python architecture
      • Python applications and their attack surfaces
      • Authentication and authorization
        • Authentication in Python
        • Authorization in Python
        • Authentication and authorization in Django
        • Authentication and authorization in Flask
      • Code protection in Python
        • Python bytecode
        • Obfuscation
        • Modifying the Python runtime
        • Weaknesses in the techniques
        • Other protection methods
        • Related security issues
        • Sandboxing
      • Python-specific security concerns
        • Vulnerabilities in multiple layers
        • Discovering vulnerable code
        • Notable vulnerabilities in Python
        • Notable vulnerabilities in Django
    • Practical cryptography
      • Rule #1 of implementing cryptography
      • Cryptosystems
        • Elements of a cryptosystem
      • Symmetric-key cryptography
        • Providing confidentiality with symmetric cryptography
        • Symmetric encryption algorithms
        • Modes of operation
      • Other cryptographic algorithms
        • Hash or message digest
        • Hash algorithms
        • SHAttered
        • Message Authentication Code (MAC)
        • Providing integrity and authenticity with a symmetric key
        • Random numbers and cryptography
        • Cryptographically-strong PRNGs
        • Hardware-based TRNGs
      • Asymmetric (public-key) cryptography
        • Providing confidentiality with public-key encryption
        • Rule of thumb – possession of private key
        • The RSA algorithm
          • Introduction to RSA algorithm
          • Encrypting with RSA
          • Combining symmetric and asymmetric algorithms
          • Digital signing with RSA
      • Public Key Infrastructure (PKI)
        • Man-in-the-Middle (MitM) attack
        • Digital certificates against MitM attack
        • Certificate Authorities in Public Key Infrastructure
        • X.509 digital certificate
      • Cryptography in Python
        • Cryptographic libraries – overview
        • Hashing
        • Random numbers
        • Symmetric encryption
        • Asymmetric encryption
        • TLS/SSL in Python
  • Day 3

    • Common coding errors and vulnerabilities
      • Input validation
        • Input validation concepts
        • Integer problems
          • Representation of negative integers
          • Integer overflow
          • Integers in Python
          • Integer problems in Python
          • Integer problem – best practices
        • Path traversal vulnerability
          • Path traversal vulnerability
          • Path traversal mitigation
          • Path traversal – best practices
        • Unvalidated redirects and forwards
          • Redirects in Django
        • Log forging
          • Some other typical problems with log files
        • Executing user-controlled code in Python
          • Dangerous code execution – eval() and exec()
          • Dangerous code execution – input()
        • String formatting issues in Python
          • Format string problems in Python
          • Information leakage – can you guess the output?
        • Taint analysis
          • Taint analysis
          • Taint analysis in Python using a library
      • Improper use of security features
        • Typical problems related to the use of security features
        • Insecure randomness
          • Weak PRNGs in Python
        • Password management
          • Exercise – Weakness of hashed passwords
          • Password management and storage
          • Special purpose hash algorithms for password storage
          • PBKDF2 and scrypt implementations in Python
          • Argon2 and bcrypt implementations in Python
          • Case study – the Ashley Madison data breach
          • Typical mistakes in password management
        • Dangers of reflection in Python
          • Python introspection and reflection – features and risks
          • Dynamic loading
          • Module injection
          • Monkey patching
          • Monkey patching example
          • Function hijacking
      • Improper error and exception handling
        • Typical problems with error and exception handling
        • Exception handling in Python
        • Empty catch block
        • Overly broad catch
        • Using multi-catch
        • Exercise ErrorHandling – spot the bug!
        • Exercise – Error handling
        • Relying on assertions for error checking – spot the bug!
      • Time and state problems
        • Concurrency and threading
        • Time-of-check-to-time-of-use (TOCTTOU)
          • Preventing file I/O TOCTTOU in Python
          • Exercise - TOCTTOU
      • Code quality problems
        • Dangers arising from poor code quality
        • Immutability
          • Immutability
          • Immutability – guess the output!
        • Context managers
          • Resource management in Python
          • Releasing resources – spot the bug!
          • An even better solution
          • Behind the with statement
          • @contextmanager decorator – spot the bug!
          • @contextmanager decorator – handling error
    • Denial of service
      • DoS introduction
      • Asymmetric DoS
      • SSL/TLS renegotiation DoS
      • Regular expression DoS (ReDoS)
        • Exercise ReDoS
        • ReDoS mitigation
        • Case study – ReDos in Stack Exchange
      • Hashtable collision attack
        • Using hashtables to store inputs
        • Hashtable collision
        • Hash tables in Python
    • Principles of security and secure coding
      • Matt Bishop’s principles of robust programming
      • The security principles of Saltzer and Schroeder
    • Knowledge sources
      • Secure coding sources – a starter kit
      • Vulnerability databases
      • Recommended books – Python security

Utbildningen levereras i samarbete med

Kursfakta

Kurs-ID: T1842
Längd: 3 dagar
Pris exkl moms: 23 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!


Avtalsrabatter och kampanjer kan ej nyttjas på denna kurs.


Ort och datum

Stockholm
20 maj-22 maj
Boka nu!
Göteborg
20 maj-22 maj
R
Boka nu!
Cloud Access
i Läs mer

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

20 maj-22 maj
Boka nu!
Helsingfors
20 maj-22 maj
R
Boka nu!
Oslo
20 maj-22 maj
R
Boka nu!

Tipsa