View Issue Details

IDProjectCategoryView StatusLast Update
0009461Talermerchant backendpublic2025-07-12 15:38
Reporterfefe Assigned ToChristian Grothoff Resolution deadline
ImplementerReviewer 
Release signed byDeployed by 
VerifierCommunicator 
Data protection authority notification requiredNo  
CSIRT notification requiredNo  
Estimated effort (hours)Actual effort (hours)0 
Fast-trackNo
Work packagenone
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionno change required 
Product Versiongit (master) 
Target Version1.0 stretch goalsFixed in Version1.0 stretch goals 
Summary0009461: determine_eligible_accounts: no escaping when building URL
Description```
 762 if (TALER_amount_is_zero (&kyc_amount))
 763 GNUNET_asprintf (&payto_kycauth,
 764 "%s%cmessage=KYC:%s",
 765 exchange_account_payto,
 766 (NULL == strchr (exchange_account_payto,
 767 '?'))
 768 ? '?'
 769 : '&',
 770 merchant_pub_str);
 771 else
 772 GNUNET_asprintf (&payto_kycauth,
 773 "%s%camount=%s&message=KYC:%s",
 774 exchange_account_payto,
 775 (NULL == strchr (exchange_account_payto,
 776 '?'))
 777 ? '?'
 778 : '&',
 779 TALER_amount2s (&kyc_amount),
 780 merchant_pub_str);
```

merchant_pub_str comes from GNUNET_STRINGS_data_to_string_alloc so it should be OK, but I'm not so sure about exchange_account_payto. Generally speaking I think abstractions exist to take burden away from the caller. This API doesn't.
What if any of the fields contain a '&'? There should be no injection possibility here. Everything should be urlencoded on demand. That does not hurt if it's not needed but prevents catastrophe if it does.
TagsNo tags attached.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Christian Grothoff

2025-01-16 16:03

manager   ~0023990

As you say: we know merchant_pub_str was just base32 encoded by us, so it must be fine.
The base exchange_account_payto MUST already be a URI, and we did validate that one extensively when we received it. Plus, it may contain complex payment instructions, we are just expected to append one more argument. Parsing the URI first, and then encoding it again -- what would that accomplish?

Christian Grothoff

2025-07-12 15:38

manager   ~0025495

I double-checked, this is just adding/appending the amount and message arguments to an existing payto URI. We just built the arguments, so there is no chance of '&' or '?' being in them. And the prefix is known to already be a well-formed URI. Escaping it again would be wrong, and parsing it again also pointless. So I think this is fine. Resolving.

Issue History

Date ModifiedUsernameFieldChange
2025-01-16 15:42fefeNew Issue
2025-01-16 15:42fefeStatusnew => assigned
2025-01-16 15:42fefeAssigned To => Christian Grothoff
2025-01-16 16:03Christian GrothoffNote Added: 0023990
2025-01-16 16:03Christian GrothoffAssigned ToChristian Grothoff => fefe
2025-01-16 16:03Christian GrothoffStatusassigned => feedback
2025-03-22 13:09Christian GrothoffCategorymechant backend => merchant backend
2025-07-11 20:42Christian GrothoffAssigned Tofefe => Christian Grothoff
2025-07-11 20:42Christian GrothoffStatusfeedback => assigned
2025-07-12 15:38Christian GrothoffStatusassigned => informing
2025-07-12 15:38Christian GrothoffResolutionopen => no change required
2025-07-12 15:38Christian GrothoffFixed in Version => 1.0 stretch goals
2025-07-12 15:38Christian GrothoffNote Added: 0025495
2025-07-12 15:38Christian GrothoffStatusinforming => closed
2025-07-12 15:38Christian GrothoffProduct Version => git (master)
2025-07-12 15:38Christian GrothoffTarget Version => 1.0 stretch goals