0
0
Testing Fundamentalstesting~20 mins

OWASP Top 10 awareness in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
OWASP Top 10 Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Injection Attacks

Which of the following best describes an Injection attack as listed in the OWASP Top 10?

AAn attacker exploits weak passwords to gain unauthorized access to user accounts.
BAn attacker intercepts data between two systems to steal sensitive information during transmission.
CAn attacker floods a server with excessive requests to make it unavailable to legitimate users.
DAn attacker sends malicious code to a program, tricking it into executing unintended commands or accessing data without proper authorization.
Attempts:
2 left
💡 Hint

Think about how attackers might trick a program into doing something it shouldn't by sending unexpected input.

Predict Output
intermediate
1:30remaining
Result of Unsafe SQL Query Construction

Consider this Python code snippet that constructs an SQL query unsafely:

user_input = "' OR '1'='1'"
query = f"SELECT * FROM users WHERE username = '{user_input}'"
print(query)

What is the printed output?

Testing Fundamentals
user_input = "' OR '1'='1'"
query = f"SELECT * FROM users WHERE username = '{user_input}'"
print(query)
ASELECT * FROM users WHERE username = '' OR '1'='1'
BSELECT * FROM users WHERE username = 'user_input'
CSELECT * FROM users WHERE username = '' OR 1=1
DSyntaxError due to incorrect string formatting
Attempts:
2 left
💡 Hint

Look carefully at how the user input is inserted into the query string.

assertion
advanced
2:00remaining
Testing for Broken Authentication

You want to write a test to check if a web application properly locks an account after 5 failed login attempts to prevent Broken Authentication.

Which assertion best verifies this behavior?

Aassert response.status_code == 500 and 'server error' in response.text
Bassert response.status_code == 403 and 'account locked' in response.text
Cassert response.status_code == 200 and 'login failed' in response.text
Dassert response.status_code == 404 and 'not found' in response.text
Attempts:
2 left
💡 Hint

Think about what status code and message indicate the account is locked.

🔧 Debug
advanced
2:00remaining
Identifying Security Misconfiguration

Given this test code snippet checking HTTP headers for security:

response = client.get('/login')
assert 'X-Frame-Options' in response.headers
assert response.headers['X-Frame-Options'] == 'DENY'
assert 'Content-Security-Policy' in response.headers
assert response.headers['Content-Security-Policy'] == "default-src 'self'"
assert 'Server' not in response.headers

Which assertion will fail if the server reveals its software version in the headers?

Testing Fundamentals
response = client.get('/login')
assert 'X-Frame-Options' in response.headers
assert response.headers['X-Frame-Options'] == 'DENY'
assert 'Content-Security-Policy' in response.headers
assert response.headers['Content-Security-Policy'] == "default-src 'self'"
assert 'Server' not in response.headers
Aassert response.headers['Content-Security-Policy'] == "default-src 'self'"
Bassert 'X-Frame-Options' in response.headers
Cassert 'Server' not in response.headers
Dassert response.headers['X-Frame-Options'] == 'DENY'
Attempts:
2 left
💡 Hint

Check which header reveals server information.

framework
expert
2:30remaining
Automating OWASP Top 10 Security Tests

You want to automate tests for OWASP Top 10 vulnerabilities using a testing framework. Which approach best ensures coverage of Cross-Site Scripting (XSS) vulnerabilities?

AInjecting script tags in input fields and asserting the output page escapes or sanitizes them to prevent script execution.
BSending SQL commands in input fields and checking for database errors in responses.
CFlooding the login endpoint with requests to test rate limiting.
DChecking if the server returns detailed error messages on invalid URLs.
Attempts:
2 left
💡 Hint

Think about how XSS attacks work and how to detect them in tests.