YesWeHack present code snippets containing several different vulnerabilities to practice your code analysis. The code snippets are beginner friendly but suitable for all levels!
~ New vulnerable code snippet at Twitter @yeswehack every Friday! 🗒
Be sure to run this in a secure environment, as the code is vulnerable and is intended to be used for learning code analysis!
A Collection of all vulnerable code snippets posted on our Twitter 📂
📜#1 - SQLi & XSS | Backslash filter collide
📜#2 - Improper file access & XSS | Invalid char and regex verificaion
📜#3 - Log Forging injection, Path traversal & Code injection | Poor filter and improper include() handling
📜#4 - XSS | Invalid user input filter
📜#5 - SSRF & Broken authorization | Trusted user input and client IP from header.
📜#6 - SSTI | Mixed input format
📜#7 - SQLi | Use of invalid variable within statement
📜#8 - CSRF | No CSRF token included
📜#9 - Open Redirect | Invalid regex handler
📜#10 - DOM XSS | Backend filter collide with client side JavaScript
📜#11 - CORS | Misconfigured Access-Control-Allow header
📜#12 - CSRF/ClickJacking | GET request CSRF with insecure delete process / ClickJacking - X-Frame-Options set in HTML meta tag.
📜#13 - censored | censored
- Broken access control - CWE-284
- Code injection - CWE-94
- Cross Site Request Forgery (CSRF) - CWE-352
- SQL injection (SQLi) - CWE-89
- Cross Site Scripting (XSS) - CWE-79
- Open Redirect - CWE-601
- Server-side template injection (SSTI) - CWE-1336
- Server Side Request Forgery (SSRF) - CWE-918
- Cross Origin Resource Sharing (CORS) - CWE-942
- Clickjacking - CWE-1021
Also included
- SQL (MySQL)
- HTML
- CSS
This will create a new MySQL user and a database for the vulnerable code snippet to use.
(You should not move code snippets or any other file within repo)
mkdir VsnippetYWH && cd VsnippetYWH;
git clone https://github.com/yeswehack/vulnerable-code-snippets.git
⚠️ Replace'<USERNAME>'
'<PASSWORD>'
'<DATABASE>'
and remove the#
. This will be your new MySQL vulnerable snippet user, password and Database!
Make sure your in the correct folder when running this commands.
sudo apt update;
sudo systemctl start mysql;
cd db/;
chmod +x setupVsnippet.sh;
./setupVsnippet.sh # '<USERNAME>' '<PASSWORD>' '<DATABASE>';
sudo systemctl restart mysql;
Inside the vulnerable snippet folder use: (Get newest snippets)
git pull
For questions, help or if you have discovered a problem with the code. Contact us on Twitter: @yeswehack 📬