Skip to content

sivaadityacoder/advance_sql_injection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๏ฟฝ๏ธ Advanced SQL Injection Testing Toolkit 2025

License: MIT Language: C Platform: Linux Security: Educational

A comprehensive SQL injection testing toolkit written in C, featuring modern detection techniques, verification capabilities, and support for multiple database systems.

๐Ÿšจ SECURITY NOTICE

โš ๏ธ FOR EDUCATIONAL AND AUTHORIZED TESTING ONLY โš ๏ธ

This toolkit is designed for:

  • Educational purposes and learning about SQL injection vulnerabilities
  • Authorized penetration testing and security assessments
  • Testing your own applications and systems
  • Security research with proper authorization

โŒ DO NOT USE FOR:

  • Unauthorized testing of third-party systems
  • Malicious attacks or illegal activities
  • Testing without explicit written permission

Users are solely responsible for compliance with local laws and regulations.

๐ŸŒŸ Features

๐Ÿ”ง Three-Tier Testing System

1. Basic Scanner (sql_injection)

  • Fast preliminary vulnerability detection
  • Simple error-based SQL injection detection
  • Lightweight and efficient
  • Perfect for quick initial assessments

2. Advanced Scanner (advanced_sqli)

  • Error-based SQL Injection Detection

    • MySQL, PostgreSQL, Oracle, MSSQL support
    • Comprehensive error pattern database
    • 16+ specialized payloads
  • Time-based SQL Injection Detection

    • Intelligent timing analysis
    • Database-specific delay functions
    • Response time measurement and validation
  • Boolean-based SQL Injection Detection

    • Logic-based vulnerability testing
    • Conditional payload analysis
    • True/false response comparison
  • Modern 2025 Features

    • Professional ASCII art interface
    • User-Agent spoofing
    • SSL/TLS support with bypass options
    • HTTP redirect following
    • Detailed vulnerability reporting
    • Rate limiting to avoid detection

3. Verification Tool (verify_sqli)

  • Reduces false positives by 90%+
  • Baseline response comparison
  • Confidence scoring system (0-100%)
  • Multi-method validation
  • Comprehensive manual verification guidance

๐Ÿ“‹ Requirements

  • GCC compiler
  • libcurl development libraries
  • Linux/Unix environment
  • Internet connection for testing

Installing Dependencies

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install gcc libcurl4-openssl-dev build-essential git

CentOS/RHEL/Fedora:

sudo yum install gcc libcurl-devel git
# or for newer versions:
sudo dnf install gcc libcurl-devel git

Arch Linux:

sudo pacman -S gcc curl git base-devel

๏ฟฝ Quick Start

1. Clone the Repository

git clone https://github.com/yourusername/sql-injection-toolkit-2025.git
cd sql-injection-toolkit-2025

2. Build All Tools

make all

3. Run Basic Test

./sql_injection "http://example.com/page.php?id=1"

4. Run Advanced Scan

./advanced_sqli "http://example.com/vulnerable.php"

5. Verify Findings

./verify_sqli "http://example.com/vulnerable.php"

๐Ÿ”ง Installation

# Clone repository
git clone https://github.com/yourusername/sql-injection-toolkit-2025.git
cd sql-injection-toolkit-2025

# Build all tools
make all

# Clean compiled files (if needed)
make clean

# Build individual tools
make sql_injection    # Basic scanner
make advanced_sqli    # Advanced scanner  
make verify_sqli      # Verification tool

# Run tests
make test

๏ฟฝ Usage Examples

Basic SQL Injection Testing

# Simple vulnerability test
./sql_injection "http://testsite.com/product.php?id=1"

# Test with existing parameters
./sql_injection "https://example.com/search.php?q=test&category=1"

Advanced Comprehensive Testing

# Full vulnerability assessment
./advanced_sqli "http://vulnerable-site.com/page.php"

# The tool will automatically test:
# - 16 error-based payloads
# - 7 time-based payloads  
# - 8 boolean-based payloads
# - Provide detailed reporting

Verification and Validation

# Verify potential vulnerabilities
./verify_sqli "http://potentially-vulnerable.com/page.php"

# This tool will:
# - Establish baseline responses
# - Test multiple validation methods
# - Provide confidence scoring
# - Suggest manual verification steps

๐ŸŽฏ Testing Methodologies

Error-Based Detection

  • Basic Syntax Errors: ', ", \
  • Logic Operators: OR, AND, UNION
  • Database Functions: VERSION(), DATABASE(), USER()
  • Information Schema: information_schema.tables

Time-Based Detection

  • MySQL: SLEEP(5), BENCHMARK()
  • PostgreSQL: PG_SLEEP(5)
  • MSSQL: WAITFOR DELAY '00:00:05'
  • Oracle: Custom delay techniques

Boolean-Based Detection

  • True Conditions: AND 1=1, AND 'a'='a'
  • False Conditions: AND 1=2, AND 'a'='b'
  • Conditional Logic: IF(), CASE WHEN

๐Ÿ›ก๏ธ Supported Databases

Database Error Detection Time Detection Boolean Detection Confidence
MySQL โœ… Excellent โœ… Excellent โœ… Excellent 95%+
PostgreSQL โœ… Excellent โœ… Excellent โœ… Excellent 95%+
Microsoft SQL Server โœ… Very Good โœ… Excellent โœ… Very Good 90%+
Oracle โœ… Good โš ๏ธ Limited โš ๏ธ Basic 80%+
SQLite โš ๏ธ Basic โŒ No โš ๏ธ Basic 60%+

๐Ÿ“Š Sample Output

Advanced Scanner Results

๐ŸŽฏ Advanced SQL Injection Scanner 2025
=====================================
Target: http://vulnerable-app.com/page.php

๐Ÿ” Testing Error-based SQL Injection...
   Testing payload: 1'
   โš ๏ธ  VULNERABLE! Detected MySQL error: You have an error in your SQL syntax

โฑ๏ธ  Testing Time-based SQL Injection...
   Testing time delay with: 1' AND SLEEP(5)--
   โš ๏ธ  VULNERABLE! Response time: 5.23s (indicates time delay)

๐Ÿ“Š SCAN RESULTS SUMMARY
======================
Total payloads tested: 31
Vulnerabilities found: 5
Confidence level: HIGH (95%)

๐Ÿšจ DETAILED VULNERABILITY REPORT:
================================
โ€ข Payload: 1'
  Method: ERROR_BASED_MySQL
  Details: You have an error in your SQL syntax
  Confidence: 95%

โš ๏ธ  RECOMMENDATION: This application is vulnerable to SQL injection.
    Implement proper input validation and parameterized queries immediately.

Verification Tool Results

๐Ÿ” SQL Injection Verification Tool 2025
========================================

๐Ÿ“‹ Establishing baseline response...
โœ… Baseline established (Size: 1,247 bytes, Time: 0.45s, HTTP: 200)

๐Ÿ“Š VERIFICATION RESULTS:
========================
Total tests: 15
Confirmed vulnerabilities: 3
Confidence level: HIGH (92%)

๐Ÿšจ CONFIRMED VULNERABLE PAYLOADS:
โ€ข 1'
โ€ข 1' OR '1'='1
โ€ข 1' AND SLEEP(5)--

๐Ÿ”ง Advanced Configuration

Custom Payloads

Modify payload arrays in source files:

// In advanced_sqli.c
const char* custom_payloads[] = {
    "your_custom_payload_here",
    "another_payload' OR 1=1--",
    NULL  // Always end with NULL
};

Timing Configuration

// Adjust timing thresholds
#define SLEEP_DELAY 2          // Base delay for time-based tests
#define CONFIDENCE_THRESHOLD 70 // Minimum confidence for reporting

Response Handling

// Modify buffer sizes
#define MAX_RESPONSE_SIZE 16384  // Maximum response size
#define MAX_URL_SIZE 1024        // Maximum URL length

๐Ÿ› Troubleshooting

Compilation Issues

# Missing libcurl development package
sudo apt-get install libcurl4-openssl-dev

# Missing build tools
sudo apt-get install build-essential

# Manual compilation
gcc -o sql_injection sql_injection.c -lcurl -lm

Runtime Issues

  • Connection refused: Check if target URL is accessible
  • SSL certificate errors: Tool automatically bypasses SSL verification
  • Timeout errors: Increase timeout in source code
  • Permission denied: Ensure executable permissions (chmod +x)

False Positives

  • Use the verification tool: ./verify_sqli <url>
  • Check confidence scores (>70% recommended)
  • Manual verification with multiple payloads
  • Cross-validate with professional tools like SQLMap

๐Ÿงช Testing Environments

Recommended Practice Targets

  • DVWA (Damn Vulnerable Web Application)
  • WebGoat
  • bWAPP (Buggy Web Application)
  • SQLi Labs
  • Mutillidae

Setting Up Test Environment

# Using Docker for safe testing
docker run -d -p 80:80 vulnerables/web-dvwa
docker run -d -p 8080:8080 webgoat/webgoat-8.0

# Test against local setup
./advanced_sqli "http://localhost/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit"

๐Ÿ“š Educational Resources

๐Ÿค Contributing

We welcome contributions! Please read our guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/enhancement)
  3. Follow C coding standards
  4. Add comprehensive comments
  5. Test thoroughly
  6. Commit changes (git commit -am 'Add new feature')
  7. Push to branch (git push origin feature/enhancement)
  8. Create Pull Request

Development Guidelines

  • Follow K&R C style
  • Include comprehensive error handling
  • Add comments for complex logic
  • Test on multiple distributions
  • Update documentation

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

โš–๏ธ Legal Disclaimer

This software is provided for educational and authorized testing purposes only. The authors and contributors:

  • Are not responsible for any misuse of this software
  • Do not encourage or support unauthorized testing
  • Strongly advocate for responsible disclosure
  • Recommend following all applicable laws and regulations

Always ensure you have explicit written permission before testing any systems you do not own.

๐Ÿ™ Acknowledgments

  • OWASP for security research and guidelines
  • libcurl team for the excellent HTTP library
  • Security community for continuous improvement
  • Ethical hackers who use tools responsibly

๏ฟฝ Support

  • Issues: Use GitHub Issues for bug reports
  • Documentation: Check VALIDATION_GUIDE.md
  • Security: Report security issues privately

๐Ÿ”ฎ Roadmap

  • Web interface for easier usage
  • XML/JSON output formats
  • Integration with CI/CD pipelines
  • Mobile app testing capabilities
  • Advanced evasion techniques
  • Machine learning detection improvements

โญ If you find this toolkit useful, please consider starring the repository!

๐Ÿ›ก๏ธ Remember: With great power comes great responsibility. Use ethically!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published