Vulnerabilities Flashcards
Cross-Site Request Forgery
- Web application accepts state-modifying requests (typically GET) without any sort of user authentication
- As a result, any web page running in the same browser can make those requests on the user’s behalf
Cross-Site Request Forgery Mitigations
Modifying state only through POST requests is good practice but only makes attacks a little harder, not impossible
Better mitigations operate using tokens:
- Embed pseudo-random token (nonce) into form or cookie
- Check token when request is received at server
- Problem: requires additional, often stateful logic on the server
SQL Injection Mitigation
Escaping “bad” characters
- Used character sets might change over time
- Restrictions can degrade strength of passwords
Use Prepared Statements
- Separate the logic of the query from the input parameters
- User input will not be part of the executable code
Cross-site Scripting (XSS)
Injecting code such that this code is executed by the clients browser as
valid HTML / JavaScript code.
Kinds of XSS
Reflective, Persistent/Stored, DOM-Based/local
Reflective XSS
Injected input is sent back to the client, e.g., using GET parameters in a URL the victim got from an attacker
Persistent/Stored XSS
Injected input is sent stored on server side and delivered in future request, e.g. guest books or user profiles
DOM-Based / local
Exploit is interpreted/executed on the client machine. No server interaction needed, but some other attack vector is needed.
XSS Mitigation
Escaping “bad” characters via built-in function
Log Overflow
DoS by PCI express backend driver by sending a large number of kernel log messages.
Log Overflow Mitigation
Limit number of requests per user
Zip backups
Restrict the resources a user can cause a system to use
Path Traversal
Read, delete or write files that are not targeted or intended
Path Traversal Mitigation
Use the security manager
Restrict file access to reading access within specified directory
Buffer Overflow
Overwrite stack
Buffer Overflow Mitigations
Stack Canaries
Harcoded Credentials
Have credentials in the code or stored in plaintext
Hardcoded Credentials Mitigations
Never store credentials in plaintext, only hashes of those
Also store credentials in external file with proper permissions
Unsalted hashes
Unsalted hashes are vulnerable to brute force attack, dictionary attacks and rainbow tables
Uncontrolled Format String Mitigation
Set format string explicitly
Sanitize
OS Command Injection
Unsanitized input is forwarded to an OS command using a pipe attack
OS Command Injection Mitigations
Try restricting the OS call to a single command
Generally avoid OS calls whenever possible
Ideally restrict inputs to those command via a whitelist
Cache Poisoning
Vulnerability to cause specific data to be cached that aids the attacker’s objective
Compression Bomb
DoS by filling up RAM or hard disk when uncompressing a compressed file
Compression Bomb Mitigations
Inspect compressed input
Keep track how many bytes have been decompressed, or limit rounds
Limit Resources for Process