Skip to content

The Web Application Firewall (WAF) is a security solution designed to protect web applications from malicious attacks such as SQL Injection, Cross-Site Scripting (XSS), and DDoS attacks. This firewall inspects, filters, and monitors incoming HTTP/HTTPS requests to ensure only legitimate traffic reaches the server.

License

Notifications You must be signed in to change notification settings

SagarMaddela/Web-Application-Firewall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ Web Application Firewall (WAF)

🚀 Introduction

The Web Application Firewall (WAF) is a security solution designed to protect web applications from malicious attacks such as SQL Injection, Cross-Site Scripting (XSS), and DDoS attacks. This firewall inspects, filters, and monitors incoming HTTP/HTTPS requests to ensure only legitimate traffic reaches the server.

🎯 Features

1. Request Filtering

  • Filters incoming requests based on IP addresses, URLs, and User-Agent headers.
  • Maintains a blacklist and whitelist for access control.

2. Signature-Based Detection

  • Detects and blocks SQL Injection (SQLi) and Cross-Site Scripting (XSS) attacks using predefined patterns and regex-based detection.

3. Anomaly-Based Detection

  • Identifies unusual request patterns and potential zero-day attacks by analyzing request frequency, payload size, and behavior.

4. Rate Limiting & DDoS Protection

  • Implements rate limiting to restrict excessive requests from a single IP.
  • Mitigates Distributed Denial-of-Service (DDoS) attacks by monitoring and blocking suspicious traffic.

5. IP Blacklisting & Whitelisting

  • Stores and enforces a list of blocked and allowed IPs to control access dynamically.

6. HTTP Protocol Validation

  • Ensures incoming requests follow proper HTTP/HTTPS standards.
  • Blocks malformed requests, unexpected HTTP methods, and protocol violations.

7. Content Inspection & Data Leak Prevention

  • Scans request bodies and responses for sensitive data exposure.
  • Prevents leakage of critical information such as credit card numbers, passwords, and PII.

8. Logging & Monitoring

  • Captures detailed logs of all incoming requests and blocked attacks.
  • Provides real-time monitoring through a dashboard.

9. SSL/TLS Support

  • Ensures encrypted communication between clients and the server using HTTPS.
  • Can be integrated with Nginx as a reverse proxy for SSL termination.

🏗️ Installation & Setup

Prerequisites

  • Node.js (v16+)
  • MongoDB (for logging and blacklisting features)
  • Nginx (for optional reverse proxy & SSL termination)

Installation Steps

# Clone the repository
git clone https://github.com/SagarMaddela/Web-Application-Firewall.git
cd waf

# Install dependencies
npm install

# Configure environment variables
cp .env.example .env
# Update .env with MongoDB credentials and JWT secret

# Start the server
npm start

🛠️ Usage

Testing SQL Injection & XSS

Use Postman or CURL to send malicious payloads:

curl -X GET "http://localhost:5000/?search=SELECT * FROM users"
curl -X POST "http://localhost:5000/submit" -d "<script>alert('XSS')</script>"

Expected Result: The WAF should block the request and return a 403 Forbidden response.

Testing Rate Limiting

for i in {1..20}; do curl -X GET "http://localhost:5000/api/resource"; done

Expected Result: Requests exceeding the threshold should be blocked with 429 Too Many Requests.

🔐 Security Measures Implemented

✅ Protection against SQL Injection & XSS attacks
✅ Rate limiting to prevent API abuse & DDoS
✅ Logging & monitoring for real-time threat detection
✅ IP whitelisting/blacklisting for access control
✅ SSL/TLS support for secure communication

📌 Roadmap & Future Enhancements

  • 🔍 Machine Learning-based Threat Detection (AI-driven anomaly detection)
  • 📊 Admin Dashboard for managing security rules & logs
  • 🏢 Multi-Tenant Support for cloud-based WAF deployment

📜 License

This project is licensed under the MIT License.

🤝 Contributing

We welcome contributions! Feel free to submit pull requests or open issues.

📧 Contact

For inquiries or support, contact us at mrsunday0708.23@gmail.com.

About

The Web Application Firewall (WAF) is a security solution designed to protect web applications from malicious attacks such as SQL Injection, Cross-Site Scripting (XSS), and DDoS attacks. This firewall inspects, filters, and monitors incoming HTTP/HTTPS requests to ensure only legitimate traffic reaches the server.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •