CVE-2026-33545: Mobsf SQL Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-hqjr-43r5-9q58
CVSS 5.3
CWE-89
Published
Advisory Summary

CVE-2026-33545 is a MODERATE (CVSS 5.3) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Mobsf libraries in the PyPI ecosystem. The issue involves mobsf has sql injection in its sqlite database viewer utils. Remediation is available by upgrading affected packages to version 4.4.6.

CVE-2026-33545 at a Glance

CVE Identifier CVE-2026-33545
GHSA Identifier GHSA-hqjr-43r5-9q58
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Mobsf
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-33545

To remediate this vulnerability, upgrade all affected Mobsf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mobsf fixed: 4.4.6
pip install mobsf>=4.4.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show mobsf

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-33545, inspect your installed packages using pip:

pip show mobsf

Analyze the terminal output to locate any version of Mobsf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.4.6), your application is affected.

Note: The pip show mobsf command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Mobsf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Description MobSF's `read_sqlite()` function in `mobsf/MobSF/utils.py` (lines 542-566) uses Python string formatting (`%`) to construct SQL queries with table names read from a SQLite database's `sqlite_master` table. When a security analyst uses MobSF to analyze a malicious mobile application containing a crafted SQLite database, attacker-controlled table names are interpolated directly into SQL queries without parameterization or escaping. This allows an attacker to: 1. **Cause Denial of Service** -- A malicious table name causes the database viewer to crash, preventing the analyst from viewing ANY data in the SQLite database. A malicious app can use this to hide sensitive data (C2 server URLs, stolen credentials, API keys) from MobSF's analysis. 2. **Achieve SQL Injection** -- The `SELECT * FROM` query on line 557 is provably injectable via `UNION SELECT`, allowing attacker-controlled data to be returned in query results. The current code structure (a `PRAGMA` statement that runs first on line 553) limits the full exploitation chain, but the underlying code is verifiably injectable. ## Root Cause The vulnerable code in `mobsf/MobSF/utils.py:542-566`: ```python def read_sqlite(sqlite_file): """Sqlite Dump - Readable Text.""" table_dict = {} try: con = sqlite3.connect(sqlite_file) cur = con.cursor() cur.execute('SELECT name FROM sqlite_master WHERE type=\'table\';') tables = cur.fetchall() for table in tables: table_dict[table[0]] = {'head': [], 'data': []} cur.execute('PRAGMA table_info(\'%s\')' % table) # <-- INJECTION POINT 1 rows = cur.fetchall() for sq_row in rows: table_dict[table[0]]['head'].append(sq_row[1]) cur.execute('SELECT * FROM \'%s\'' % table) # <-- INJECTION POINT 2 rows = cur.fetchall() for sq_row in rows: tmp_row = [] for each_row in sq_row: tmp_row.append(str(each_row)) table_dict[table[0]]['data'].append(tmp_row) except Exception: logger.exception('Reading SQLite db') return table_dict ``` **Lines 553 and 557** use `%` string formatting to interpolate `table` (a tuple from `sqlite_master`) directly into SQL strings. The `table` value is attacker-controlled when the SQLite database originates from a malicious application being analyzed. ## Attack Vector The `read_sqlite()` function is called from two locations: 1. **Dynamic Analysis File Viewer** (`mobsf/DynamicAnalyzer/views/common/device.py:64`): - Triggered when an analyst clicks to view a `.db` file in device data - Applies to both Android and iOS dynamic analysis 2. **iOS Static Analysis File Viewer** (`mobsf/StaticAnalyzer/views/ios/views/view_source.py:123`): - Triggered when an analyst clicks to view a `.db` file during iOS static analysis ### Attack Scenario 1. Attacker creates a malicious Android APK (or iOS IPA) containing a SQLite database with a crafted table name in the `assets/` directory 2. The SQLite database contains a table created with: ```sql CREATE TABLE "x' UNION SELECT 'SQL_INJECTION_PROOF'--" (id INTEGER); ``` 3. Security analyst uploads the application to MobSF for analysis 4. Analyst browses the extracted files and clicks to view the SQLite database 5. MobSF's `read_sqlite()` reads table names from `sqlite_master`, including the malicious name `x' UNION SELECT 'SQL_INJECTION_PROOF'--` 6. The table name is interpolated into SQL queries via string formatting: - `PRAGMA table_info('x' UNION SELECT 'SQL_INJECTION_PROOF'--')` -- causes syntax error (DoS) - `SELECT * FROM 'x' UNION SELECT 'SQL_INJECTION_PROOF'--'` -- SQL injection (UNION SELECT returns attacker data) ## Impact ### Denial of Service (Confirmed) When the malicious table name is the first table in `sqlite_master` (i.e., created first in the database), the `PRAGMA` statement on line 553 raises a `sqlite3.OperationalError`, which is caught by the outer `try/except`. This causes `read_sqlite()` to return an empty or partial result, preventing the analyst from viewing **any** database content. **Security impact:** A malicious app author can use this technique to **hide incriminating data** stored in SQLite databases from MobSF's analysis. This directly undermines MobSF's core purpose as a security analysis tool. ### SQL Injection (Confirmed in Isolation) The `SELECT * FROM` query on line 557 is demonstrably injectable. When the malicious table name `x' UNION SELECT 'SQL_INJECTION_PROOF'--` is interpolated, the resulting query: ```sql SELECT * FROM 'x' UNION SELECT 'SQL_INJECTION_PROOF'--' ``` Successfully executes and returns attacker-controlled data via `UNION SELECT`. The `--` comments out the trailing single quote. This is verified by the PoC script. **Note:** In the current code structure, the `PRAGMA table_info()` statement on line 553 runs before the `SELECT * FROM` on line 557. The PRAGMA fails with a syntax error for injected payloads, which triggers the exception handler before the SELECT can execute. This limits the full exploitation chain. However, the code flaw is real and any future refactoring that changes the execution order or removes the PRAGMA would immediately expose the full SQL injection. ## Proof of Concept ### Files Provided(Gdrive) | File | Description | |------|-------------| | `poc_sqlite_injection.py` | Standalone PoC demonstrating the vulnerability | | `malicious.db` | Crafted SQLite database (generated by PoC) | | `create_malicious_apk.sh` | Script to package the malicious DB into an APK | | `malicious_sqli.apk` | Pre-built APK for testing against MobSF | https://drive.google.com/drive/folders/1mNGkFfNowkaZ5J018HFi4IQcnjKaWCym?usp=sharing ### Running the PoC ```bash # Run the standalone PoC (no MobSF required) python3 poc_sqlite_injection.py # Build the malicious APK (requires Android SDK) ./create_malicious_apk.sh # Test against MobSF # 1. Start MobSF # 2. Upload malicious_sqli.apk # 3. Browse extracted files -> click app_data.db # 4. Observe: database viewer fails (DoS) ``` ### PoC Output (Abbreviated) ``` [STEP 2] Running MobSF's read_sqlite() against malicious database... [!] EXCEPTION CAUGHT: OperationalError: near "UNION": syntax error [!] DoS CONFIRMED: read_sqlite() crashed [STEP 3] Demonstrating SELECT * FROM injection in isolation... Query: SELECT * FROM 'x' UNION SELECT 'SQL_INJECTION_PROOF'--' [+] Query executed successfully! [+] Results: [('SQL_INJECTION_PROOF',), ('normal_data',)] [+] SQL INJECTION CONFIRMED [STEP 4] Complete DoS (malicious table created first): Tables with data: NONE [!] COMPLETE DoS CONFIRMED ``` ## Suggested Fix Replace string formatting with properly quoted identifiers. SQLite uses double quotes for identifiers: ```python def read_sqlite(sqlite_file): """Sqlite Dump - Readable Text.""" table_dict = {} try: con = sqlite3.connect(sqlite_file) cur = con.cursor() cur.execute('SELECT name FROM sqlite_master WHERE type=\'table\';') tables = cur.fetchall() for table in tables: table_name = table[0] # Properly escape table name as a double-quoted identifier safe_name = table_name.replace('"', '""') table_dict[table_name] = {'head': [], 'data': []} cur.execute(f'PRAGMA table_info("{safe_name}")') rows = cur.fetchall() for sq_row in rows: table_dict[table_name]['head'].append(sq_row[1]) cur.execute(f'SELECT * FROM "{safe_name}"') rows = cur.fetchall() for sq_row in rows: tmp_row = [] for each_row in sq_row: tmp_row.append(str(each_row)) table_dict[table_name]['data'].append(tmp_row) except Exception: logger.exception('Reading SQLite db') return table_dict ``` This escapes any double quotes within table names by doubling them (`"` → `""`), which is the standard SQL mechanism for identifier quoting. This prevents breakout from the double-quoted identifier context. ## Resources - **CWE-89**: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') - **OWASP SQL Injection**: https://owasp.org/www-community/attacks/SQL_Injection - **Affected File**: `mobsf/MobSF/utils.py`, lines 542-566

CVE-2026-33545 Affected Mobsf Versions

1 component(s)
Fixed Versions:
4.4.6
Product / Package Ecosystem Affected Versions Fixed Version
mobsf
PyPI
< 4.4.6
4.4.6

References

Frequently Asked Questions

What is CVE-2026-33545?
CVE-2026-33545 is a security vulnerability in Mobsf involving MobSF has SQL Injection in its SQLite Database Viewer Utils under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Mobsf versions are affected?
Affected versions include releases prior to 4.4.6 across affected packages: mobsf.
What version fixes CVE-2026-33545?
Upgrading to 4.4.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mobsf affected?
Yes, mobsf is affected in releases prior to 4.4.6. Upgrade your dependency to 4.4.6 or later.
What is the CVSS score of CVE-2026-33545?
CVE-2026-33545 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-33545?
CVE-2026-33545 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check PyPI dependencies for CVE-2026-33545?
Run the dependency tree command: 'pip show mobsf'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hqjr-43r5-9q58",
  "modified" : "2026-03-27T21:17:40Z",
  "published" : "2026-03-24T19:23:52Z",
  "aliases" : [ "CVE-2026-33545" ],
  "summary" : "MobSF has SQL Injection in its SQLite Database Viewer Utils",
  "details" : "## Description\n\nMobSF's `read_sqlite()` function in `mobsf/MobSF/utils.py` (lines 542-566) uses Python string formatting (`%`) to construct SQL queries with table names read from a SQLite database's `sqlite_master` table. When a security analyst uses MobSF to analyze a malicious mobile application containing a crafted SQLite database, attacker-controlled table names are interpolated directly into SQL queries without parameterization or escaping.\n\nThis allows an attacker to:\n\n1. **Cause Denial of Service** -- A malicious table name causes the database viewer to crash, preventing the analyst from viewing ANY data in the SQLite database. A malicious app can use this to hide sensitive data (C2 server URLs, stolen credentials, API keys) from MobSF's analysis.\n\n2. **Achieve SQL Injection** -- The `SELECT * FROM` query on line 557 is provably injectable via `UNION SELECT`, allowing attacker-controlled data to be returned in query results. The current code structure (a `PRAGMA` statement that runs first on line 553) limits the full exploitation chain, but the underlying code is verifiably injectable.\n\n## Root Cause\n\nThe vulnerable code in `mobsf/MobSF/utils.py:542-566`:\n\n```python\ndef read_sqlite(sqlite_file):\n    \"\"\"Sqlite Dump - Readable Text.\"\"\"\n    table_dict = {}\n    try:\n        con = sqlite3.connect(sqlite_file)\n        cur = con.cursor()\n        cur.execute('SELECT name FROM sqlite_master WHERE type=\\'table\\';')\n        tables = cur.fetchall()\n        for table in tables:\n            table_dict[table[0]] = {'head': [], 'data': []}\n            cur.execute('PRAGMA table_info(\\'%s\\')' % table)    # <-- INJECTION POINT 1\n            rows = cur.fetchall()\n            for sq_row in rows:\n                table_dict[table[0]]['head'].append(sq_row[1])\n            cur.execute('SELECT * FROM \\'%s\\'' % table)         # <-- INJECTION POINT 2\n            rows = cur.fetchall()\n            for sq_row in rows:\n                tmp_row = []\n                for each_row in sq_row:\n                    tmp_row.append(str(each_row))\n                table_dict[table[0]]['data'].append(tmp_row)\n    except Exception:\n        logger.exception('Reading SQLite db')\n    return table_dict\n```\n\n**Lines 553 and 557** use `%` string formatting to interpolate `table` (a tuple from `sqlite_master`) directly into SQL strings. The `table` value is attacker-controlled when the SQLite database originates from a malicious application being analyzed.\n\n## Attack Vector\n\nThe `read_sqlite()` function is called from two locations:\n\n1. **Dynamic Analysis File Viewer** (`mobsf/DynamicAnalyzer/views/common/device.py:64`):\n   - Triggered when an analyst clicks to view a `.db` file in device data\n   - Applies to both Android and iOS dynamic analysis\n\n2. **iOS Static Analysis File Viewer** (`mobsf/StaticAnalyzer/views/ios/views/view_source.py:123`):\n   - Triggered when an analyst clicks to view a `.db` file during iOS static analysis\n\n### Attack Scenario\n\n1. Attacker creates a malicious Android APK (or iOS IPA) containing a SQLite database with a crafted table name in the `assets/` directory\n2. The SQLite database contains a table created with:\n   ```sql\n   CREATE TABLE \"x' UNION SELECT 'SQL_INJECTION_PROOF'--\" (id INTEGER);\n   ```\n3. Security analyst uploads the application to MobSF for analysis\n4. Analyst browses the extracted files and clicks to view the SQLite database\n5. MobSF's `read_sqlite()` reads table names from `sqlite_master`, including the malicious name `x' UNION SELECT 'SQL_INJECTION_PROOF'--`\n6. The table name is interpolated into SQL queries via string formatting:\n   - `PRAGMA table_info('x' UNION SELECT 'SQL_INJECTION_PROOF'--')` -- causes syntax error (DoS)\n   - `SELECT * FROM 'x' UNION SELECT 'SQL_INJECTION_PROOF'--'` -- SQL injection (UNION SELECT returns attacker data)\n\n## Impact\n\n### Denial of Service (Confirmed)\n\nWhen the malicious table name is the first table in `sqlite_master` (i.e., created first in the database), the `PRAGMA` statement on line 553 raises a `sqlite3.OperationalError`, which is caught by the outer `try/except`. This causes `read_sqlite()` to return an empty or partial result, preventing the analyst from viewing **any** database content.\n\n**Security impact:** A malicious app author can use this technique to **hide incriminating data** stored in SQLite databases from MobSF's analysis. This directly undermines MobSF's core purpose as a security analysis tool.\n\n### SQL Injection (Confirmed in Isolation)\n\nThe `SELECT * FROM` query on line 557 is demonstrably injectable. When the malicious table name `x' UNION SELECT 'SQL_INJECTION_PROOF'--` is interpolated, the resulting query:\n\n```sql\nSELECT * FROM 'x' UNION SELECT 'SQL_INJECTION_PROOF'--'\n```\n\nSuccessfully executes and returns attacker-controlled data via `UNION SELECT`. The `--` comments out the trailing single quote. This is verified by the PoC script.\n\n**Note:** In the current code structure, the `PRAGMA table_info()` statement on line 553 runs before the `SELECT * FROM` on line 557. The PRAGMA fails with a syntax error for injected payloads, which triggers the exception handler before the SELECT can execute. This limits the full exploitation chain. However, the code flaw is real and any future refactoring that changes the execution order or removes the PRAGMA would immediately expose the full SQL injection.\n\n## Proof of Concept\n\n### Files Provided(Gdrive)\n\n| File | Description |\n|------|-------------|\n| `poc_sqlite_injection.py` | Standalone PoC demonstrating the vulnerability |\n| `malicious.db` | Crafted SQLite database (generated by PoC) |\n| `create_malicious_apk.sh` | Script to package the malicious DB into an APK |\n| `malicious_sqli.apk` | Pre-built APK for testing against MobSF |\n\nhttps://drive.google.com/drive/folders/1mNGkFfNowkaZ5J018HFi4IQcnjKaWCym?usp=sharing\n\n\n### Running the PoC\n\n```bash\n# Run the standalone PoC (no MobSF required)\npython3 poc_sqlite_injection.py\n\n# Build the malicious APK (requires Android SDK)\n./create_malicious_apk.sh\n\n# Test against MobSF\n# 1. Start MobSF\n# 2. Upload malicious_sqli.apk\n# 3. Browse extracted files -> click app_data.db\n# 4. Observe: database viewer fails (DoS)\n```\n\n### PoC Output (Abbreviated)\n\n```\n[STEP 2] Running MobSF's read_sqlite() against malicious database...\n    [!] EXCEPTION CAUGHT: OperationalError: near \"UNION\": syntax error\n    [!] DoS CONFIRMED: read_sqlite() crashed\n\n[STEP 3] Demonstrating SELECT * FROM injection in isolation...\n    Query: SELECT * FROM 'x' UNION SELECT 'SQL_INJECTION_PROOF'--'\n    [+] Query executed successfully!\n    [+] Results: [('SQL_INJECTION_PROOF',), ('normal_data',)]\n    [+] SQL INJECTION CONFIRMED\n\n[STEP 4] Complete DoS (malicious table created first):\n    Tables with data: NONE\n    [!] COMPLETE DoS CONFIRMED\n```\n\n## Suggested Fix\n\nReplace string formatting with properly quoted identifiers. SQLite uses double quotes for identifiers:\n\n```python\ndef read_sqlite(sqlite_file):\n    \"\"\"Sqlite Dump - Readable Text.\"\"\"\n    table_dict = {}\n    try:\n        con = sqlite3.connect(sqlite_file)\n        cur = con.cursor()\n        cur.execute('SELECT name FROM sqlite_master WHERE type=\\'table\\';')\n        tables = cur.fetchall()\n        for table in tables:\n            table_name = table[0]\n            # Properly escape table name as a double-quoted identifier\n            safe_name = table_name.replace('\"', '\"\"')\n            table_dict[table_name] = {'head': [], 'data': []}\n            cur.execute(f'PRAGMA table_info(\"{safe_name}\")')\n            rows = cur.fetchall()\n            for sq_row in rows:\n                table_dict[table_name]['head'].append(sq_row[1])\n            cur.execute(f'SELECT * FROM \"{safe_name}\"')\n            rows = cur.fetchall()\n            for sq_row in rows:\n                tmp_row = []\n                for each_row in sq_row:\n                    tmp_row.append(str(each_row))\n                table_dict[table_name]['data'].append(tmp_row)\n    except Exception:\n        logger.exception('Reading SQLite db')\n    return table_dict\n```\n\nThis escapes any double quotes within table names by doubling them (`\"` → `\"\"`), which is the standard SQL mechanism for identifier quoting. This prevents breakout from the double-quoted identifier context.\n\n## Resources\n\n- **CWE-89**: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')\n- **OWASP SQL Injection**: https://owasp.org/www-community/attacks/SQL_Injection\n- **Affected File**: `mobsf/MobSF/utils.py`, lines 542-566",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "mobsf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.4.6"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.4.5"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/MobSF/Mobile-Security-Framework-MobSF/security/advisories/GHSA-hqjr-43r5-9q58"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33545"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/MobSF/Mobile-Security-Framework-MobSF/commit/6f8a43c1b78d21cfbd7186aaafa7f622d990e0f1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/MobSF/Mobile-Security-Framework-MobSF"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/MobSF/Mobile-Security-Framework-MobSF/releases/tag/v4.4.6"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-24T19:23:52Z",
    "nvd_published_at" : "2026-03-26T21:17:06Z"
  }
}