View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012187 | Taler | exchange | public | 2026-11-18 15:01 | 2026-11-18 15:02 |
| Reporter | bot-cg [agent] | ||||
| Priority | normal | Severity | crash | ||
| Status | new | ||||
| Summary | 0012187: POST /reveal-melt: the number of keys in age_commitment is not checked, so a wrong count aborts taler-exchange-httpd | ||||
| Description | TEH_handler_reveal_melt() parses the optional age_commitment with TALER_JSON_spec_age_commitment(), which accepts 1 to 31 keys. compare_age_commitment() (taler-exchange-httpd_post-reveal-melt.c) then sets the mask to TEH_age_restriction_mask and calls TALER_age_commitment_hash(), which does GNUNET_assert (popcount (mask) - 1 == num). Nothing in between compares the number of keys the client sent with the number of age groups, so a reveal for an age-restricted melt whose age_commitment has a different number of keys aborts the whole httpd. The same assert is in TALER_age_commitment_derive(), reached later from verify_commitment(). The other two users of the same JSON helper do check the count before hashing: taler-exchange-httpd_common_deposit.c (purse deposits) and the merchant's /pay handler. Found by reading the code at 2a57cbcaf; not reproduced at runtime. The attached patch rejects the request with 400 TALER_EC_EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_COMMITMENT_INVALID when the count does not match. | ||||
| Additional Information | Any customer can reach this with a melt of an age-restricted coin of their own; the melt is not consumed, so the request can be repeated. | ||||
| Tags | No tags attached. | ||||
| Attached Files | 12187-exchange-check-the-size-of-the-age-commitment-in-rev.patch (1,601 bytes)
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Wed, 18 Nov 2026 16:01:54 +0100
Subject: [PATCH] exchange: check the size of the age commitment in
/reveal-melt
TALER_age_commitment_hash() asserts that the number of keys matches the
age mask, so a client-supplied commitment of the wrong size must be
refused before hashing, as /purses/$PID/deposit already does.
Issue: https://bugs.taler.net/n/12187
Assisted by LLM
---
.../taler-exchange-httpd_post-reveal-melt.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/exchange/taler-exchange-httpd_post-reveal-melt.c b/src/exchange/taler-exchange-httpd_post-reveal-melt.c
index a13808024..20039297d 100644
--- a/src/exchange/taler-exchange-httpd_post-reveal-melt.c
+++ b/src/exchange/taler-exchange-httpd_post-reveal-melt.c
@@ -188,6 +188,19 @@ compare_age_commitment (
{
struct TALER_AgeCommitmentHashP ach;
+ if (__builtin_popcount (TEH_age_restriction_mask.bits) - 1 !=
+ (int) actx->age_commitment.num)
+ {
+ /* number of public keys in the commitment does not match the
+ number of age groups */
+ GNUNET_break_op (0);
+ *mhd_ret = TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_COMMITMENT_INVALID,
+ "age_commitment");
+ return GNUNET_SYSERR;
+ }
actx->age_commitment.mask = TEH_age_restriction_mask;
TALER_age_commitment_hash (
&actx->age_commitment,
--
2.47.3
| ||||
| child of | 0012186 | new | Unchecked array lengths and counts in exchange, merchant and anastasis: review after 2a57cbcaf [meta] |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-11-18 15:01 | bot-cg | New Issue | |
| 2026-11-18 15:01 | bot-cg | Relationship added | child of 0012186 |
| 2026-11-18 15:01 | bot-cg | Implementer | => oec |
| 2026-11-18 15:01 | bot-cg | Reviewer | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Release signed by | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Deployed by | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Verifier | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Communicator | => CM_7 |
| 2026-11-18 15:02 | bot-cg | File Added: 12187-exchange-check-the-size-of-the-age-commitment-in-rev.patch |