Skip to content

Commit 3baf7bd

Browse files
committed
Full Remake
WAF Identification The tool can detect Web Application Firewalls (WAFs) by looking at the HTTP headers and the server's responses. It can identify potential WAFs by checking for changes in the response status code and content. Fingerprinting The tool can figure out what type of database is being used by analyzing errors and using SQL injection techniques like UNION or stacked queries. The queries are generated automatically by a custom tool. Interpreter The tool automatically selects the correct SQL language to use for SQL injection attacks, since different databases require different syntax. Resolver (Beta) This feature is still in development. It helps identify table columns and the name of the current database. Injection Types The tool supports different types of SQL injections, including: Blind (Boolean and Time-based) Error-based UNION-based These injections are automatically created by the custom query generator. GUI (Graphical User Interface) The tool has a modern, easy-to-use graphical interface that’s friendly for beginners. SQL Query Generator The tool generates SQL payloads and queries tailored for each database management system (DBMS), with unique openings, endings, and other custom elements for each type of DBMS.
1 parent 276a67d commit 3baf7bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+12327
-360
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@
2020
# Go workspace file
2121
go.work
2222
/.idea
23+
/frontend/dist
24+
/node_modules

README.md

Lines changed: 75 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,78 @@
11
# GoInjection
2-
![img.png](img.png)
3-
4-
## Overview
5-
This project is designed to perform SQL injection testing on various database systems. It includes functions to determine the number of columns in a database table and to identify the database type based on the response to SQL injection queries.
6-
7-
## Features
8-
- SQL Injection Testing: Perform SQL injection testing on various database systems.
9-
- Column Count Detection: Determine the number of columns in a database table using SQL injection.
10-
- Database Type Identification: Identify the database type (MySQL, PostgreSQL, MsSQL, SQLite) based on SQL injection responses.
11-
- Word Count Analysis: Count the occurrences of words in the response to help identify the database.
12-
- WAF Detection: Detect the presence of Web Application Firewalls (WAF) by analyzing HTTP responses and status codes.
13-
- WAF Identification: Identify specific WAFs (e.g., Cloudflare, Cloudfront, Akamai, Sucuri) based on HTTP headers and response content.
14-
- Multi-DBMS Support: Support for multiple database management systems (DBMS) including MySQL, PostgreSQL, MsSQL, and SQLite.
15-
16-
## Testing
17-
```py
18-
pip install flask
19-
pip install mysql-connector-python
2+
![GoInjection Banner](img.png)
3+
4+
<p align="center">
5+
<a href="#Features">🔧 Features</a> |
6+
<a href="#WAFIdentification">🛡️ WAF Identification</a> |
7+
<a href="#Fingerprinting">🔍 Fingerprinting</a> |
8+
<a href="#InjectionTypes">💥 Injection Types</a> |
9+
<a href="#GUI">🎨 GUI</a> |
10+
<a href="#SQLQueryBuilder">⚙️ SQL Query Builder</a>
11+
</p>
12+
13+
<p align="center">
14+
<a href="https://github.com/Axion-Security/GoInjection/actions">
15+
<img alt="CI Status" src="https://img.shields.io/github/actions/workflow/status/Axion-Security/GoInjection/go.yml?branch=main">
16+
</a>
17+
<a href="https://opensource.org/licenses/MIT">
18+
<img alt="License" src="https://img.shields.io/badge/License-CC NonCommercial-blue.svg">
19+
</a>
20+
<a href="https://github.com/yourusername/GoInjection/stargazers">
21+
<img alt="Stars" src="https://img.shields.io/github/stars/Axion-Security/GoInjection">
22+
</a>
23+
</p>
24+
25+
## 🚀 Features
26+
27+
### 🛡️ WAF Identification
28+
- Detect Web Application Firewalls (WAFs) by analyzing HTTP headers and server responses.
29+
- Identifies potential WAFs based on changes in response status codes and content patterns.
30+
31+
### 🔍 Fingerprinting
32+
- Automatically detects the type of database by analyzing errors and executing advanced SQL injection techniques like UNION and stacked queries.
33+
- Custom tool-generated queries ensure precise fingerprinting.
34+
35+
### ⚙️ Interpreter
36+
- Automatically selects the correct SQL dialect (MySQL, PostgreSQL, MSSQL, etc.) based on the target DBMS.
37+
- Ensures the right syntax for effective SQL injections.
38+
39+
### 🧩 Resolver
40+
- In development, this feature helps identify table columns and the name of the current database for more advanced injections.
41+
- Essential for gaining deeper access to database structures.
42+
43+
### 💥 Injection Types
44+
- Supports **Blind Injections** (Boolean and Time-based), **Error-based Injections**, and **UNION-based Injections**.
45+
- Queries for these injection types are automatically created by the tool’s custom query generator.
46+
47+
### 🎨 GUI (Graphical User Interface)
48+
- Modern, user-friendly interface designed to simplify the process, making it accessible for both experienced pentesters and beginners.
49+
- Features intuitive controls for both new and experienced users.
50+
51+
### ⚙️ SQL Query Builder
52+
- Generates tailored SQL payloads for each DBMS, optimizing query structure, including custom openings, endings, and elements.
53+
- Fully automated query builder for each injection type.
54+
55+
## 📦 Installation
56+
57+
### Prerequisites:
58+
Ensure you have Python 3.x installed and the required dependencies:
59+
60+
```bash
61+
pip install flask pymysql
2062
```
63+
64+
### Setup:
65+
Clone the repository and install dependencies:
66+
67+
```bash
68+
git clone https://github.com/Axion-Security/GoInjection.git
69+
pip install flask pymysql
70+
```
71+
72+
## 📝 Usage Example
73+
74+
Set up a basic SQL Injection Lab for testing:
75+
2176
```sql
2277
USE sql_injection_lab;
2378

@@ -34,12 +89,7 @@ INSERT INTO products (name, price) VALUES
3489
('Headphones', 49.99),
3590
('Smartwatch', 199.99);
3691
```
37-
The project includes a test site that is located in `SQL_Injection_Lab.py` file.
3892

39-
## ToDo
40-
- Add more methods for Getting Database and Columns.
41-
- Add Table dumping.
42-
- Make a GUI for the project.
93+
## 🔑 License
4394

44-
## License
45-
This project is licensed under the MIT License. See the `LICENSE` file for more details.
95+
This project is licensed under the [License](/LICENSE). See the `LICENSE` file for more details.

SQL_Injection_Lab.py

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
from flask import Flask, request, render_template_string
2-
import mysql.connector
3-
import re
2+
import pymysql
43

54
app = Flask(__name__)
65

76
def get_db_connection():
8-
return mysql.connector.connect(
7+
"""Establish and return a database connection using PyMySQL."""
8+
return pymysql.connect(
99
host="localhost",
1010
user="root",
1111
password="",
12-
database="sql_injection_lab"
12+
database="sql_injection_lab",
13+
cursorclass=pymysql.cursors.DictCursor
1314
)
1415

15-
def waf_filter(input_data):
16-
patterns = [
17-
r"('|\-\-|\;|--|\bUNION\b|\bSELECT\b|\bINSERT\b|\bDROP\b|\bUPDATE\b)",
18-
r"(\bOR\s1=1\b)",
19-
]
20-
21-
for pattern in patterns:
22-
if re.search(pattern, input_data, re.IGNORECASE):
23-
return False
24-
25-
return True
26-
2716
@app.route('/')
2817
def index():
2918
return render_template_string('''
@@ -36,54 +25,30 @@ def index():
3625
</form>
3726
''')
3827

39-
@app.route('/waf_product', methods=['GET'])
40-
def waf_product():
41-
product_id = request.args.get('id')
42-
43-
if not waf_filter(product_id):
44-
return "<h2>Potential SQL Injection attempt blocked by WAF</h2>"
45-
46-
conn = get_db_connection()
47-
cursor = conn.cursor()
48-
49-
query = f"SELECT * FROM products WHERE id = '{product_id}'"
50-
try:
51-
cursor.execute(query)
52-
product = cursor.fetchone()
53-
conn.close()
54-
if product:
55-
return f"<h2>Product Details</h2><p>ID: {product[0]}</p><p>Name: {product[1]}</p><p>Price: {product[2]}</p>"
56-
else:
57-
return "<h2>No product found</h2>"
58-
except mysql.connector.Error as err:
59-
conn.close()
60-
return f"<h2>SQL Error: {err}</h2>"
61-
except Exception as e:
62-
conn.close()
63-
return f"<h2>Error: {str(e)}</h2>"
64-
6528
@app.route('/product', methods=['GET'])
6629
def product():
6730
product_id = request.args.get('id')
6831

6932
conn = get_db_connection()
7033
cursor = conn.cursor()
7134

72-
query = f"SELECT * FROM products WHERE id = '{product_id}'"
35+
# Vulnerable query (using string formatting directly)
36+
query = "SELECT * FROM products WHERE id = '%s'" % product_id # SQL Injection vulnerability
7337
try:
7438
cursor.execute(query)
7539
product = cursor.fetchone()
7640
conn.close()
41+
7742
if product:
78-
return f"<h2>Product Details</h2><p>ID: {product[0]}</p><p>Name: {product[1]}</p><p>Price: {product[2]}</p>"
43+
return f"<h2>Product Details</h2><p>ID: {product['id']}</p><p>Name: {product['name']}</p><p>Price: {product['price']}</p>"
7944
else:
8045
return "<h2>No product found</h2>"
81-
except mysql.connector.Error as err:
46+
except pymysql.Error as err:
8247
conn.close()
83-
return f"<h2>SQL Error: {err}</h2>"
48+
return f"<h2>SQL Error:</h2><pre>{err}</pre>"
8449
except Exception as e:
8550
conn.close()
86-
return f"<h2>Error: {str(e)}</h2>"
51+
return f"<h2>Unexpected Error:</h2><pre>{str(e)}</pre>"
8752

8853
if __name__ == '__main__':
8954
app.run(debug=True)

0 commit comments

Comments
 (0)