Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test_vulnerable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
import sqlite3

def login_user(username, password):
# VULNERABILITY: SQL Injection
conn = sqlite3.connect('users.db')
cursor = conn.cursor()
query = f"SELECT * FROM users WHERE username='{username}' AND password='{password}'"
cursor.execute(query)
return cursor.fetchone()

def execute_command(cmd):
# VULNERABILITY: Command Injection
os.system(f"ping -c 1 {cmd}")

def read_file(filename):
# VULNERABILITY: Path Traversal
with open(f"/var/data/{filename}", 'r') as f:
return f.read()