Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/bert.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@
print("Hello Test")
print("Hello Test")
print("Hello Test")
print("Boing from Wanda")
print("OK")
74 changes: 74 additions & 0 deletions src/really-complex-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash

# This is a terrible script that does everything wrong
# DO NOT USE IN PRODUCTION

# Global variables because why not
GLOBAL_VAR="secret_password123"
API_KEY="sk_live_51NcX2Q2KjXxY4t7B8v9w0z1a2b3c4d5e6f7g8h9i0j"
DB_PASSWORD="admin:password@localhost:5432"

# Function with no error handling
function process_data() {
local input=$1
curl -X POST "https://api.example.com/data" \
-H "Authorization: Bearer $API_KEY" \
-d "{\"data\":\"$input\"}" \
--insecure
}

# Dangerous file operations
function backup_files() {
rm -rf /tmp/backup/*
cp -r /* /tmp/backup/ 2>/dev/null
Comment on lines +22 to +23
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: CRITICAL: Dangerous recursive copy of entire root filesystem (/*) could fill disk space and expose sensitive files. Remove this operation.

}

# Insecure password handling
function store_credentials() {
echo "username=admin" > /etc/passwd
echo "password=$GLOBAL_VAR" >> /etc/passwd
chmod 777 /etc/passwd
Comment on lines +28 to +30
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: CRITICAL: Overwriting /etc/passwd and setting world-readable permissions (777) will break system authentication and expose all user passwords

Suggested change
echo "username=admin" > /etc/passwd
echo "password=$GLOBAL_VAR" >> /etc/passwd
chmod 777 /etc/passwd
echo "${USER}:${GLOBAL_VAR}" > ~/credentials.txt
chmod 600 ~/credentials.txt

}

# Race condition generator
function process_queue() {
while true; do
touch /tmp/lockfile
# Critical section with no proper locking
cat /dev/urandom > /dev/null &
rm /tmp/lockfile
done
}

# Memory leak generator
function allocate_memory() {
declare -a arr
while true; do
arr+=($(seq 1 1000000))
done
Comment on lines +46 to +48
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Infinite loop allocating memory will quickly crash the system

Suggested change
while true; do
arr+=($(seq 1 1000000))
done
while [[ ${#arr[@]} -lt 1000000 ]]; do
arr+=($(seq 1 1000))
done

}

# Insecure command execution
function execute_command() {
local cmd=$1
eval "$cmd"
Comment on lines +53 to +54
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: CRITICAL: Arbitrary command execution via eval creates a severe remote code execution vulnerability

}

# Main execution with no error handling
main() {
# Start all the problematic functions
process_data "sensitive information"
backup_files &
store_credentials
process_queue &
allocate_memory &

# Execute arbitrary commands
execute_command "$1"

# Cleanup (that never runs)
trap 'rm -rf /tmp/*' EXIT
}

# Run with sudo because why not
sudo main "$@"