Skip to content

cosmin-panescu/Web-Vulnerability-Scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Web Security Scanner - Technical Documentation

Project Overview

This project is a comprehensive web security scanning tool designed to identify and report vulnerabilities in websites. The application consists of a full-stack architecture with Python/Flask backend services and JavaScript frontend. The tool provides a user-friendly interface to scan websites for common vulnerabilities, generate reports, and visualize security scores.

Application Architecture

The application follows a client-server architecture with the following components:

  1. Main Security Scanner Backend

    • Core scanning functionality for detecting vulnerabilities
    • Handles HTTP request analysis and security header checks
    • Implements SSL/TLS security assessment
    • Provides vulnerability detection for SQL Injection, XSS, and form vulnerabilities
    • Technology detection capabilities
  2. Report Generation Backend

    • AI-enhanced PDF analysis service for vulnerability reporting
    • Extracts text from uploaded security PDFs
    • Integrates with OpenAI API to analyze vulnerabilities
  3. Frontend Components

    • Report generation functionality
    • Security score calculation and visualization

Backend Components

Main Security Scanner

Core Functionalities:

  • Security Header Analysis: Checks for missing security headers like Content-Security-Policy, X-Frame-Options, etc.
  • SSL/TLS Assessment: Verifies certificate validity, supported protocols, and identifies vulnerabilities
  • Configuration Analysis: Identifies security misconfigurations in HTTP settings
  • Vulnerability Detection:
    • SQL Injection testing with various payloads
    • Cross-Site Scripting (XSS) detection
    • Form vulnerability analysis
  • Technology Detection: Identifies web technologies, frameworks, and server types

API Endpoints:

  • GET /: Serves the frontend application
  • GET /<path:filename>: Serves static files
  • POST /scan: Main endpoint that performs security scanning
    • Returns comprehensive security assessment results

PDF Analysis Service

This service is designed to extract text from security report PDFs and analyze them using AI.

Core Functionalities:

  • PDF Text Extraction: Extracts text from uploaded PDF files
  • AI-Enhanced Analysis: Uses OpenAI GPT-3.5 Turbo to analyze security vulnerabilities from the generated report
  • Memory-Efficient Processing: Implements strategies to handle PDFs with large file sizes

API Endpoints:

  • POST /api/upload-pdf: Handles PDF uploads and returns vulnerability analysis
    • Accepts multipart form data with a PDF file
    • Returns AI-generated analysis of vulnerabilities detected in the report

Frontend Components

Report Generation

The generateReport() function creates comprehensive PDF reports of security scans using jsPDF.

Features:

  • Title page with scanned URL and timestamp
  • Security score visualization
  • Detailed sections for:
    • Missing security headers
    • Security misconfigurations
    • SSL/TLS analysis and certificate details
    • Detected vulnerabilities (SQL Injection, XSS, vulnerable forms)
    • Technology detection results

Security Score Calculation

The frontend implements a scoring feature that calculates a security score based on detected issues.

UI Components:

  • Results Display: Shows a summary of scan results with color-coded indicators
  • Score Visualization: Circular progress indicator that changes color based on score
  • Report Download: Button to generate and download comprehensive PDF reports

Key Security Checks

Security Headers

The application checks for the presence of critical security headers:

  • Strict-Transport-Security: Protects against MiTM attacks by forcing HTTPS
  • Content-Security-Policy: Prevents XSS and injection attacks
  • X-Frame-Options: Prevents clickjacking attacks
  • X-Content-Type-Options: Prevents MIME sniffing
  • Referrer-Policy: Controls referrer information

SSL/TLS Analysis

Comprehensive SSL/TLS security assessment including:

  • Certificate validation and expiration checking
  • Protocol support analysis (identifying insecure TLS 1.0/1.1)
  • Cipher suite evaluation
  • Security best practices verification

Vulnerability Testing

SQL Injection

The application uses a variety of SQL injection payloads to test URL parameters and form inputs, including:

  • Basic SQL syntax testing (', ")
  • Authentication bypass attempts (' OR '1'='1)
  • Database manipulation payloads (1'; DROP TABLE users; --)
  • Union-based injection attempts (' UNION SELECT 1,2,3 --)

Cross-Site Scripting (XSS)

Tests for XSS vulnerabilities with payloads like:

  • Basic script execution (<script>alert(1)</script>)
  • Event handler injections (<img src=x onerror=alert(1)>)
  • JavaScript URI schemes (javascript:alert(1))
  • HTML attribute injections
  • DOM-based XSS vectors

Form Vulnerability Analysis

  • Identifies insecure form implementations
  • Tests each form field with various payloads
  • Detects reflection of unsanitized input

Usage Instructions

Running the Scanner

  1. Enter a target URL in the input field
  2. Click the scan button to initiate the security assessment
  3. Review the comprehensive results:
    • Overall security score
    • Missing security headers
    • Detected vulnerabilities
    • SSL/TLS configuration issues
    • Identified technologies

PDF Report

The generated PDF report contains:

  • Security score and summary
  • Detailed vulnerability assessment
  • Technical findings organized by category
  • Certificate details for HTTPS sites
  • Technology stack information

AI-Enhanced Analysis

To utilize the AI analysis feature:

  1. Upload a security report PDF (max 2MB)
  2. The system will extract text and analyze vulnerabilities
  3. Review the AI-generated assessment of security issues

Technical Requirements

Backend

  • Python 3.6+
  • Flask web framework
  • Required Python libraries:
    • requests
    • BeautifulSoup4
    • PyPDF2
    • OpenAI Python client
    • python-dotenv
    • flask-cors
    • OpenSSL

Frontend

  • HTML5, CSS3, JavaScript
  • jsPDF library for PDF generation

Conclusion

This web security scanner provides a comprehensive solution for identifying security vulnerabilities in web applications. By combining automated scanning with AI-enhanced analysis, it offers both technical details and actionable insights to improve web application security posture.

Releases

No releases published

Packages

No packages published