Quick Start Guide - capstone-hermes/hermes-fullstack GitHub Wiki

Quick Start Guide

Prerequisites

Before you begin, ensure you have the following installed on your system:

  • Docker (version 20.0+) and Docker Compose (version 2.0+)
  • Git for cloning the repository
  • Node.js (version 18+) - optional, for local development
  • curl or Postman - for API testing

๐Ÿš€ Launch the Application

Option 1: Docker Compose (Recommended)

  1. Clone the Repository
git clone <repository-url>
cd hermes-fullstack/weak-website
  1. Start the Application
# Development mode with hot reload
docker-compose -f docker-compose.dev.yml up --build -d

# Or production mode
docker-compose up --build -d
  1. Verify Services
# Check all containers are running
docker-compose ps

# Expected output:
# NAME                    STATUS
# weak-website-client-1   Up
# weak-website-server-1   Up  
# weak-website-db-1      Up

Option 2: Local Development

  1. Start Database
docker run -d \
  --name weak-website-db \
  -e MYSQL_ROOT_PASSWORD=password \
  -e MYSQL_DATABASE=hermes-weak-website-db \
  -e MYSQL_USER=user \
  -e MYSQL_PASSWORD=password \
  -p 3306:3306 \
  mysql:latest
  1. Start Backend Server
cd server
npm install
npm run start:dev
  1. Start Frontend Client
cd client
npm install
npm run dev

๐ŸŒ Access Points

Once the application is running, you can access:

Service URL Description
Client Application http://localhost:8081 Main web interface
API Server http://localhost:8080 REST API endpoints
API Documentation http://localhost:8080/api Swagger/OpenAPI docs
Database localhost:3306 MySQL database (internal)

๐Ÿ‘ค Test Accounts

The application comes with pre-configured test accounts:

Default Admin Account

Email: [email protected]
Password: password123
Role: admin

Default User Account

Email: [email protected]  
Password: userpass123
Role: user

๐Ÿงช Quick Vulnerability Test

1. SQL Injection Test

# Test authentication bypass
curl -X POST http://localhost:8080/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"admin'\''--","password":"anything"}'

Expected Result: Successful login despite wrong password

2. XSS Test

  1. Navigate to http://localhost:8081/login
  2. Login with test credentials
  3. Go to Dashboard and create a post with content: <script>alert('XSS')</script>
  4. View the feed to see the alert execute

3. File Upload Test

# Upload a test file
echo '<?php echo "Hello from PHP"; ?>' > test.php
curl -X POST http://localhost:8080/file/upload \
  -F "[email protected]"

# Access uploaded file
curl http://localhost:8080/uploads/test.php

4. Path Traversal Test

# Try to access system files
curl "http://localhost:8080/file/retrieve?path=../../../../etc/passwd"

๐Ÿ› ๏ธ Troubleshooting

Common Issues

Port Conflicts

# Check if ports are in use
netstat -tulpn | grep -E ':8080|:8081|:3306'

# Kill processes using required ports
sudo kill -9 $(lsof -t -i:8080)
sudo kill -9 $(lsof -t -i:8081)
sudo kill -9 $(lsof -t -i:3306)

Docker Issues

# Stop all containers
docker-compose down

# Remove containers and volumes
docker-compose down -v

# Rebuild with no cache
docker-compose up --build --force-recreate

Database Connection Issues

# Check database logs
docker-compose logs db

# Reset database
docker-compose down -v
docker-compose up -d db
# Wait 30 seconds for initialization
docker-compose up -d server client

Permission Issues (Linux/Mac)

# Fix file permissions
sudo chown -R $USER:$USER .
chmod -R 755 .

Logs and Debugging

View Application Logs

# All services
docker-compose logs -f

# Specific service
docker-compose logs -f server
docker-compose logs -f client
docker-compose logs -f db

Access Container Shell

# Server container
docker-compose exec server bash

# Client container  
docker-compose exec client sh

# Database container
docker-compose exec db mysql -u user -p hermes-weak-website-db

Environment Variables

Default Development Configuration

# Database
DB_HOST=db
DB_PORT=3306
DB_USER=user
DB_PASSWORD=password
DB_DATABASE=hermes-weak-website-db

# Server
SERVER_PORT=8080
JWT_SECRET=hardcoded-secret

# Client
CLIENT_PORT=8081
VITE_SERVER_URL=http://localhost:8080

๐Ÿ“‹ Application Features Overview

Public Features (No Authentication)

  • Landing Page (/) - Application overview and navigation
  • User Registration (/signup) - Create new user accounts
  • User Login (/login) - Authenticate existing users
  • Public Feed (/feed) - View all posts (vulnerable to XSS)
  • Security Info (/security-info) - Vulnerability documentation
  • File Upload (/file-upload) - Upload files (unrestricted)

Protected Features (Authentication Required)

  • Dashboard (/dashboard) - User dashboard with post creation
  • Change Password (/change-password) - Password modification
  • User Profile - View and edit profile information

API Endpoints

  • Authentication - /auth/login, /auth/signup, /auth/change-password
  • Posts - /posts/create, /posts/all
  • File Operations - /file/upload, /file/download/:filename, /file/retrieve
  • Users - /users/profile, /users/create
  • Validation - Various endpoints for testing input validation

๐Ÿ”’ Security Features (Intentionally Disabled)

The following security measures are intentionally disabled for educational purposes:

Input Validation

  • โŒ SQL injection protection
  • โŒ XSS prevention
  • โŒ Input sanitization
  • โŒ Parameter validation

File Security

  • โŒ File type restrictions
  • โŒ File size limits
  • โŒ Path traversal protection
  • โŒ Virus scanning

Authentication Security

  • โŒ Strong password requirements
  • โŒ Rate limiting
  • โŒ Account lockout
  • โŒ Secure session management

Error Handling

  • โŒ Generic error messages
  • โŒ Stack trace hiding
  • โŒ Sensitive information protection

๐Ÿ“š Next Steps

For Learning

  1. Explore the Application - Navigate through all features to understand functionality
  2. Read Documentation - Review Vulnerability Overview for security issues
  3. Try Basic Exploits - Start with SQL Injection tutorial
  4. Advanced Techniques - Progress to Cross-Site Scripting and File Upload Attacks

For Testing

  1. Manual Testing - Use browser and curl to test vulnerabilities
  2. Automated Tools - Try tools like Burp Suite, OWASP ZAP, or SQLMap
  3. Custom Scripts - Develop your own testing scripts
  4. Methodology - Follow Testing Methodology for systematic testing

For Development

  1. Code Review - Examine source code for vulnerability patterns
  2. Secure Coding - Study how to fix the implemented vulnerabilities
  3. Additional Features - Add new vulnerabilities for practice
  4. Defensive Measures - Implement proper security controls

โš ๏ธ Important Reminders

Security Warnings

  • Isolated Environment Only - Never deploy on public networks
  • Educational Purpose - Use only for learning and authorized testing
  • Data Protection - Don't use real personal information
  • Responsible Disclosure - Report real vulnerabilities through proper channels

Best Practices

  • Document Everything - Keep notes of your testing activities
  • Clean Up - Remove uploaded files and test accounts when done
  • Stay Updated - Check for updates to the application and documentation
  • Share Knowledge - Contribute to the educational community

Next: Continue to User Guide for detailed feature documentation or jump to SQL Injection to start exploiting vulnerabilities.

Need Help?: Check the Troubleshooting page or review the logs using the commands above.

โš ๏ธ **GitHub.com Fallback** โš ๏ธ