PC Parts Store is a full-featured, intentionally vulnerable PHP/MySQL-based eCommerce application built for cybersecurity testing, red team labs, and OWASP vulnerability demonstrations. This project simulates real-world web application flaws in a realistic UI.
A quick preview of the PC Parts Store interface:
Home Page | Product Listing |
---|---|
![]() |
![]() |
Cart Page | Admin Dashboard |
---|---|
![]() |
![]() |
This lab provides hands-on experience with:
- Offensive web exploitation (SQLi, XSS, IDOR, CSRF, etc.)
- Secure coding awareness by contrast
- DAST/SAST tool testing (e.g. sqlmap, Burp Suite, OWASP ZAP)
- Red team labs and secure code analysis
- CTF-style exercises and simulated targets
pc-parts-store/
βββ admin/ # Admin interface (no access control, IDOR, user deletion via GET)
β βββ dashboard.php # No role enforcement, fake stats (broken auth)
β βββ orders.php # Credit card data exposure, CSV injection
β βββ users.php # Mass assignment, IDOR, account deletion via β GET
β
βββ api/ # Insecure JSON API endpoints (unauthenticated)
β βββ products.php # SQL Injection, XSS in JSON output
β βββ reviews.php # Stored XSS, IDOR (spoofed user ID)
β βββ checkout.php # Raw credit card data via POST, no session
β βββ login.php # Insecure JWTs, stored in localStorage
β
βββ assets/
β βββ css/ # Modular styling (clean UI, insecure inputs)
β
βββ includes/ # Core PHP logic (intentionally insecure)
β βββ db.php # Hardcoded credentials, no prepared statements
β βββ auth.php # Plaintext password comparison
β βββ utils.php # Open redirect with $_GET['url']
β βββ header.php # Top nav
β βββ footer.php # Footer scripts
β
βββ index.php # Homepage (reflected XSS, open redirect)
βββ product.php # Product details (IDOR, stored XSS)
βββ products.php # SQLi via ?search= or ?category=
βββ cart.php # LocalStorage cart, IDOR in removal
βββ checkout.php # Credit card form with no validation or auth
βββ login.php # SQL Injection, plaintext password
βββ register.php # Mass assignment, no validation
βββ pc_part_store.sql # MySQL DB dump (preloaded)
Type | Pages / Features | OWASP Category |
---|---|---|
SQL Injection | products.php , login.php , api/products.php |
A1: Injection |
Reflected XSS | index.php (?msg=) , product.php |
A7: Cross-Site Scripting |
Stored XSS | Product reviews | A7: Cross-Site Scripting |
Broken Auth | login.php , auth.php |
A2: Broken Authentication |
CSRF | cart.php , checkout.php |
A5: Broken Access Control |
Insecure JWT | api/login.php , localStorage |
A2: Broken Auth |
IDOR | product.php?id= , users.php?delete= |
A5: Access Control |
Plaintext PW | auth.php , login.php |
A3: Sensitive Data Exposure |
Insecure Redirects | utils.php (redirect($_GET['url']) ) |
A10: Redirects |
Security Misconfig | .htaccess , php.ini |
A6: Misconfiguration |
- PHP 7.x/8.x
- MariaDB / MySQL
- Apache2 or Nginx
sqlmap
,curl
(optional for testing)
git clone https://github.com/jgpython/pc-parts-store.git
cd pc-parts-store
mysql -u root -p < pc_part_store.sql
This will create the pc_part_store
database with all users, products, reviews, and orders.
Copy or link the project to your web root (e.g., /var/www/html/
):
sudo cp -r pc-parts-store /var/www/html/
Then start/restart Apache & MySQL:
sudo systemctl restart apache2 sudo systemctl restart mysql
Access the site in your browser at:
http://localhost/pc-parts-store/
This project includes a pre-seeded user table with realistic accounts for testing login flows, role-based access, and authentication bypass techniques (e.g. SQLi). All credentials are plaintext and designed for demo or red-team testing only.
Username | Password | Role | Description |
---|---|---|---|
admin |
admin123 |
admin | Default superuser account for admin access. Vulnerable to SQLi login bypass. |
john_doe |
password1 |
user | Normal user, used in reviews and orders. |
test_user |
qwerty |
user | Generic account for basic testing. |
jane_doe |
pass123 |
user | Additional user to test IDOR and user visibility. |
gamerz |
abc123 |
user | Simulates gaming enthusiast purchases. |
hwtester |
testtest |
user | Good for testing edge-case reviews or feedback loops. |
exploit_dev |
exploitme |
admin | βBackdoorβ admin account for red team testing. |
rootkitz |
root123 |
user | Useful for account enumeration or brute-force scenarios. |
xssqueen |
s3cure! |
user | Submit stored XSS reviews using this account. |
sqlinjector |
dropdb |
user | Ideal for blind/time-based injection testing. |
Feature | user Role |
admin Role |
---|---|---|
Browse Products | β | β |
Add Reviews | β | β |
Submit Orders | β | β |
View Cart | β | β |
Admin Dashboard (admin/ ) |
β | β |
Delete Users / Orders | β | β |
View All Orders | β | β |
Access APIs | β (unauthenticated) | β (with POST, more data) |
-
Try logging in as
admin' --
for SQL Injection bypass -
Submit reviews as
xssqueen
using<script>alert(1)</script>
for stored XSS -
Use
exploit_dev
to delete users/orders from the exposed admin panel -
Purchase products with
john_doe
and verify orders insert intoorders
table
Explore the core vulnerabilities intentionally built into this application. These scenarios are great for CTFs, red team exercises, or educational penetration testing labs.
π Test | π§ͺ How to Perform | |
---|---|---|
SQL Injection | Use products.php?search=anything'-- directly in the browser, or run: sqlmap -u "http://localhost/pc-parts-store/products.php?search=test" --batch --level=5 --risk=3 |
Confirms improper sanitization of user input, leading to SQL execution. Exploitable on products.php , login.php , and parts of admin/ . |
Reflected XSS | Visit: index.php?msg=<script>alert(1)</script> |
Demonstrates lack of output encoding on reflected data (e.g. error messages or status). |
Stored XSS | Submit a product review (e.g., product.php?id=1 ) with: <script>alert(1)</script> |
Proves that review inputs are stored and rendered without sanitization, allowing persistent XSS payloads. |
IDOR (Insecure Direct Object Reference) | Access: product.php?id=9999 or admin/users.php?delete=2 without auth |
Showcases unrestricted access to resources or user manipulation without authorization checks. |
CSRF (Cross-Site Request Forgery) | From another origin (e.g., attacker page), submit a request like: GET cart.php?remove=1 |
Highlights absence of CSRF tokens or validation, allowing unauthorized actions if user is authenticated. |
Insecure JWT / localStorage tokens | Login and inspect browser localStorage for the token key |
The token is a base64-encoded JSON blob, not signed or encrypted, allowing spoofing or tampering. |
Login Bypass via SQLi | Use this payload in the username field: admin' -- Password can be anything |
Proves that the login query is injectable. This bypasses password checks and grants access. |
Plaintext Credential Exposure | View includes/db.php or inspect network traffic |
Demonstrates poor password storage and hardcoded DB credentials. No hashing or encryption used. |
Credit Card Data Capture (Raw) | Visit checkout.php , fill in any values, inspect traffic |
Reveals insecure transmission of sensitive data (e.g., credit cards) with no HTTPS enforcement or session validation. |
π‘ Tip: Tools like Burp Suite, sqlmap, Postman, and browser dev tools (Storage tab, Console) are perfect for testing this siteβs intentional flaws.
Below are some example SQLMap commands to test the most vulnerable endpoints in the PC Parts Store project. These simulate automated exploitation of SQL injection flaws built intentionally into the application.
β οΈ These are for educational/red team use only. Make sure you're authorized to test the application before running any automated tools.
sqlmap -u "http://localhost/pc-parts-store/products.php?search=test" --batch --risk=3 --level=5
-
Why? Tests the
search
parameter for injection. -
Result: Can enumerate tables, extract data, or dump the full database if successful.
sqlmap -u "http://localhost/pc-parts-store/product.php?id=1" --dbs --batch
-
Why? The
id
parameter is directly passed to the SQL query. -
Result: Lists databases and confirms injection in the product detail page.
sqlmap -u "http://localhost/pc-parts-store/login.php" --data="user=admin&pass=admin123" --batch
-
Why? Simulates SQL injection via POST data.
-
Result: Confirms injectable login credentials check, useful for blind or boolean-based attacks.
π οΈ Advanced Usage:
-
Dump table contents:
--dump -T users -D pc_part_store
-
Enumerate user credentials or hashes (if implemented):
--passwords
-
Bypass WAFs:
--tamper=space2comment,between
This project is intentionally vulnerable. Do not expose it to the public internet. Use only in isolated, safe, local, or containerized environments. The author and contributors are not responsible for misuse.
MIT License β Use freely for educational, CTF, research, or red team purposes.
jgpython
Cybersecurity Researcher / Developer
GitHub: @jgpython