-
Notifications
You must be signed in to change notification settings - Fork 14
Boing from Wanda #2405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Boing from Wanda #2405
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,3 +31,5 @@ | |
| print("Hello Test") | ||
| print("Hello Test") | ||
| print("Hello Test") | ||
| print("Boing from Wanda") | ||
| print("OK") | ||
| 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 | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| # 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| # 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: Infinite loop allocating memory will quickly crash the system
Suggested change
|
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| # Insecure command execution | ||||||||||||||
| function execute_command() { | ||||||||||||||
| local cmd=$1 | ||||||||||||||
| eval "$cmd" | ||||||||||||||
|
Comment on lines
+53
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 "$@" | ||||||||||||||
There was a problem hiding this comment.
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.