SecureBank

«««< HEAD This project was created by Abi

It is a Next.js project built on React and TailwindCSS.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the code in src. The page auto-updates as you edit the file.

To learn more, take a look at the following resources:

This project serves as an educational tool to help learners understand real-world security vulnerabilities and their mitigation techniques.

⚠️ Disclaimer: This project is for educational purposes only. Do NOT use it in production environments. The vulnerabilities are intentionally included to facilitate learning.

πŸš€ Features & Vulnerabilities SecureBank is intentionally designed with multiple security vulnerabilities, making it an ideal target for ethical hacking and penetration testing exercises. It includes:

βœ… Weak Authentication Mechanism (Hardcoded credentials, weak password policy) βœ… JWT Token Exploitation (Insecure storage, predictable token structure) βœ… SQL Injection (SQLi) (Direct database queries without parameterization) βœ… Cross-Site Scripting (XSS) (Unsanitized user input, stored & reflected XSS) βœ… Sensitive Data Exposure (API key leakage, debug comments with secrets) βœ… Broken Access Control (Users can perform unauthorized transactions) βœ… Insufficient Security Logging (Limited security monitoring) βœ… Lack of Security Headers (No CSP, HSTS, or other protection mechanisms) βœ… Insecure Direct Object References (IDOR) (Users can access unauthorized data) βœ… CSRF & Form Security Issues (No CSRF protection, rate limiting) πŸ› οΈ Installation & Setup Follow these steps to clone and set up SecureBank locally:

1️⃣ Clone the Repository git clone https://github.com/YOUR_GITHUB_USERNAME/SecureBank.git cd SecureBank 2️⃣ Install Dependencies npm install 3️⃣ Run the Application npm run dev 4️⃣ Access the App Open your browser and go to http://localhost:3000 πŸ” Vulnerability Breakdown & Exploitation Guide 1️⃣ Weak Authentication πŸ“Œ Location: handleLogin function πŸ“Œ Issue: Hardcoded credentials (admin/password123, test/test123)

πŸ”₯ Attack: Attempt logging in with known weak credentials. Brute-force other potential usernames and passwords. πŸ” Fix: βœ… Enforce a strong password policy. βœ… Use proper password hashing (bcrypt, Argon2). βœ… Implement rate limiting & account lockout after multiple failed attempts.

2️⃣ SQL Injection (SQLi) πŸ“Œ Location: handleTransfer function πŸ“Œ Issue: Direct SQL query concatenation without parameterized queries

πŸ”₯ Attack: Inject SQL queries in the transfer input field: sql β€˜ OR 1=1 – Extract sensitive user data or manipulate transactions. πŸ” Fix: βœ… Use prepared statements & parameterized queries. βœ… Sanitize user inputs.

3️⃣ Cross-Site Scripting (XSS) πŸ“Œ Location: Message Board (dangerouslySetInnerHTML) πŸ“Œ Issue: Directly rendering user input without sanitization

πŸ”₯ Attack: Inject a malicious script into the message field: πŸ” Fix: βœ… Implement HTML sanitization before rendering messages. βœ… Use Content Security Policy (CSP) to prevent script execution.

4️⃣ Sensitive Data Exposure πŸ“Œ Issue: API key exposed in front-end code πŸ“Œ Example: sk_test_51ABCxyz (Stored in useState)

πŸ”₯ Attack: Extract API keys from the source code using browser dev tools. πŸ” Fix: βœ… Move sensitive data to environment variables. βœ… Never expose secrets in the front-end code.

5️⃣ Broken Access Control πŸ“Œ Issue: No validation of user permissions before performing transactions

πŸ”₯ Attack: Modify transfer requests to send money from another user’s account. πŸ” Fix: βœ… Implement role-based access control (RBAC). βœ… Validate user permissions before executing any action.

6️⃣ Missing Security Headers πŸ“Œ Issue: No CSP, HSTS, X-Frame-Options, etc.

πŸ”₯ Attack: Clickjacking, iframe injections, and XSS attacks. πŸ” Fix: βœ… Add security headers in server configuration: Strict-Transport-Security: max-age=31536000; includeSubDomains Content-Security-Policy: default-src β€˜self’ X-Frame-Options: DENY πŸ” Security Best Practices βœ… Implement Multi-Factor Authentication (MFA) βœ… Use bcrypt/Argon2 for password hashing βœ… Implement OAuth2.0 / JWT best practices βœ… Perform input validation & sanitization βœ… Secure sensitive data with encryption (AES, RSA) βœ… Add server-side logging & monitoring

🌍 Deployment Hosting on Vercel/Netlify To deploy SecureBank on Vercel or Netlify, follow these steps:

1️⃣ Deploy on Vercel npm install -g vercel vercel login vercel 2️⃣ Deploy on Netlify npm install -g netlify-cli netlify login netlify deploy πŸ΄β€β˜ οΈ Ethical Hacking Tools to Use πŸ”Ή Burp Suite – To intercept & modify requests πŸ”Ή SQLMap – To test for SQL Injection πŸ”Ή OWASP ZAP – To scan for web vulnerabilities πŸ”Ή Metasploit – For penetration testing

🀝 Contributing We welcome contributions! Feel free to:

Report issues πŸ› Submit pull requests πŸš€ Suggest security improvements πŸ” ⚠️ Disclaimer This project is intentionally insecure and should only be used for learning and testing purposes. Do NOT deploy this in a production environment. The authors are not responsible for any misuse of this code.

πŸ“œ License This project is licensed under the MIT License.

πŸ’‘ Want More Security Projects? Follow me on GitHub and LinkedIn for more security research and ethical hacking projects! πŸš€

ad44a5a41b324025d2252199ef807d58e515f57d