Cyber Security Web Application Lab for Secure Coding & Vulnerability Demonstration.
DeceptionGrid LAB adalah project pembelajaran keamanan aplikasi web berbasis PHP dan MySQL yang menyediakan dua environment berbeda:
vulnerable/→ aplikasi yang sengaja dibuat rentansecure/→ aplikasi yang sudah diperbaiki dengan implementasi secure coding
Lab ini dibuat untuk:
- Praktikum keamanan web
- Demonstrasi vulnerability
- Pembelajaran secure coding
- Simulasi exploit dan patching
- Presentasi materi cyber security
Lab ini membahas beberapa topik utama:
- Input Validation & XSS
- SQL Injection
- Password Security
- Session Management
- Secure File Upload
- Server Permission Security
- CSRF Protection
- Output Encoding
- Authentication Security
- Defense in Depth
lab-learn/
├── assets
│ ├── css
│ └── js
├── index.php
├── README.md
├── secure
│ ├── admin.php
│ ├── config.php
│ ├── dashboard.php
│ ├── edit_profile.php
│ ├── index.php
│ ├── login.php
│ ├── logout.php
│ ├── register.php
│ ├── upload.php
│ └── view_image.php
└── vulnerable
├── admin.php
├── config.php
├── dashboard.php
├── edit_profile.php
├── index.php
├── login.php
├── logout.php
├── register.php
├── upload.php
└── uploadsFolder vulnerable/ berisi aplikasi yang sengaja dibuat tidak aman untuk tujuan pembelajaran.
Contoh:
$query = "SELECT * FROM users WHERE email='$email' AND password='$password'";Payload bypass login:
' OR 1=1 -- -Reflected XSS:
?search=<script>alert(1)</script>
Stored XSS:
<img src=x onerror=alert(1)>Menggunakan:
md5()Yang sudah tidak aman terhadap brute force dan rainbow table attack.
Vulnerable upload menerima file berbahaya seperti:
shell.php
shell.php.png
Yang dapat menyebabkan:
- Remote Code Execution (RCE)
- Web shell upload
- Server takeover
Query SQL ditampilkan langsung ke user ketika error.
Contoh:
$error = "Login failed: " . $query;Folder secure/ merupakan versi aplikasi yang sudah diamankan menggunakan secure coding.
$stmt = $pdo->prepare("SELECT * FROM users WHERE email = ?");
$stmt->execute([$email]);Mencegah SQL Injection.
htmlspecialchars($input, ENT_QUOTES, 'UTF-8');Mencegah XSS.
password_hash()
password_verify()Menggunakan hashing modern bawaan PHP.
Menggunakan CSRF token:
$_SESSION['csrf_token']Fitur:
- Session regeneration
- HttpOnly cookie
- SameSite cookie
- Session timeout
- Session fixation protection
Implementasi:
- MIME validation
- Extension validation
- UUID filename
- Upload di luar web root
- File serving via PHP
- File permission hardening
- Random filename generation
File upload pada secure environment disimpan di:
/var/uploads/Bukan di dalam:
/var/www/Hal ini dilakukan untuk mencegah file upload dieksekusi langsung oleh web server.
Jika file upload disimpan di dalam web root:
/var/www/html/uploads/Attacker dapat mengakses file secara langsung melalui browser:
http://target/uploads/shell.php
Yang dapat menyebabkan:
- Remote Code Execution
- Web shell access
- Full server compromise
User Upload -> /var/www/uploads -> Accessible Directly
User Upload -> /var/uploads -> Served Securely via PHP
File ditampilkan menggunakan:
view_image.php
Bukan direct access ke filesystem.
File dibaca menggunakan:
readfile()Dengan validasi:
- UUID filename
- File existence check
- MIME validation
- Access control
sudo chown www-data:www-data /var/uploads
sudo chmod 700 /var/uploadsJika menggunakan Apache:
php_admin_flag engine offAtau:
RemoveHandler .php
RemoveType .php- PHP
- MySQL / MariaDB
- Apache2
- HTML5
- CSS3
- JavaScript
- Font Awesome
git clone https://github.com/cxnbhnq-a/DeceptionGrid-LAB.gitsudo mv DeceptionGrid-LAB /var/www/lab-learnCreate database:
CREATE DATABASE student_registration;Import schema and configure database credentials inside:
secure/config.php
vulnerable/config.phpsudo mkdir -p /var/uploads
sudo chown www-data:www-data /var/uploads
sudo chmod 700 /var/uploadssudo systemctl restart apache2Lab ini cocok untuk demonstrasi:
- SQL Injection Login Bypass
- Reflected XSS
- Stored XSS
- Weak Hash Exploitation
- File Upload RCE
- Session Security
- Secure Coding
- Defense in Depth
- Access Control
- Secure Authentication
Project ini dibuat hanya untuk:
- edukasi
- praktikum
- penelitian keamanan
- pembelajaran secure coding
Jangan gunakan teknik yang dipelajari untuk aktivitas ilegal.