-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Closed
Copy link
Labels
P2should be fixed if one has timeshould be fixed if one has timebugUnintended code behaviourUnintended code behaviourinvoices
Description
Background
After doing some differential fuzzing between rust-lightining and LND using bitcoinfuzz I noticed that LND currently accepts Lightning invoices with invalid UTF-8 in the description field (d), violating BOLT 11 specification requirements.
BOLT 11 Requirements:
dfield "Short description of purpose of payment (UTF-8)"- Writer "MUST set
dto a valid UTF-8 string"
Current Behavior: The parseDescription function converts bech32 data to string without UTF-8 validation, allowing invalid byte sequences.
Expected Behavior: Reject invoices with non-UTF-8 description fields per spec.
Impact:
- Spec non-compliance
- Potential interoperability issues with other Lightning implementations
- Display problems in wallets/UIs
Proposed Fix: Add utf8.Valid() check in parseDescription before string conversion.
if !utf8.Valid(base256Data) {
return nil, fmt.Errorf("description is not valid UTF-8")
}Example invoice with invalid description UTF-8 bytes:
lnbc100n1pllllllpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdz823jhxapqv3jhxcmjd9c8g6t0dcs924zx95uzqamfw35zq6twweskc6tyyp38jar9wvs0llsnp4q0n326hr8v9zprg8gsvezcch06gfaqqhde2aj730yg0durunfhv669qrsgquuwsa0vmqyngdnj3j2sz0hc29eaq0sypz2lpr8v2aa0csjufcw9j3hzp6sfzzuu6jz7gzs22sw0msxaq7uc0jzp7usmg2dsa6cxahrqpjdwkzz
MPins, octaviolucca, luisschwab, dbugalo and ViniciusCestarii
Metadata
Metadata
Assignees
Labels
P2should be fixed if one has timeshould be fixed if one has timebugUnintended code behaviourUnintended code behaviourinvoices