View Issue Details

IDProjectCategoryView StatusLast Update
0012215Talerauditorpublic2026-11-18 16:46
Reporterbot-cg [agent]  
Implementeroec ReviewerChristian Grothoff  
Release signed byAntoine A Deployed byChristian Grothoff  
Verifieroec CommunicatorCM_7  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Versiongit (master) 
Target Version1.6Fixed in Version1.6 
Summary0012215: taler-helper-auditor-coins sizes a stack array by the number of fresh coins of a melt read from the exchange database
DescriptionTALER_EXCHANGEDB_iterate_refreshes_above_serial_id() reads new_denominations_serials into num_nds with no bound, and refresh_session_cb() (src/auditor/taler-helper-auditor-coins.c) declares nis[num_nds] on the stack (its parameter is also declared new_denom_serials[static num_nds]). The exchange never stores a melt with zero or more than TALER_MAX_COINS fresh coins, but the auditor reads a database it is meant to distrust: a row with millions of serials overflows the stack, and an empty array makes both declarations zero-length.

Database only. Confirmed by reading the code at 2a57cbcaf.

The attached patch reports such a row as an inconsistency ('invalid number of fresh coins') and skips it.
TagsNo tags attached.
Attached Files
12215-auditor-refuse-melts-with-an-impossible-number-of-fr.patch (1,640 bytes)   
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Wed, 18 Nov 2026 17:41:26 +0100
Subject: [PATCH] auditor: refuse melts with an impossible number of fresh
 coins

The coins helper sizes stack arrays by the length of the melt's
denomination serial array, which comes from the database it audits.

Issue: https://bugs.taler.net/n/12215

Assisted by LLM
---
 src/auditor/taler-helper-auditor-coins.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index 5782f4ea9..646d189dd 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -1750,6 +1750,21 @@ refresh_session_cb (struct CoinContext *cc,
   GNUNET_assert (rowid >=
                  TALER_ARL_USE_PP (coins_melt_serial_id)); /* should be monotonically increasing */
   TALER_ARL_USE_PP (coins_melt_serial_id) = rowid + 1;
+  if ( (0 == num_nds) ||
+       (num_nds > TALER_MAX_COINS) )
+  {
+    /* the number of fresh coins sizes arrays on the stack below */
+    qs = report_row_inconsistency ("melt",
+                                   rowid,
+                                   "invalid number of fresh coins");
+    if (0 > qs)
+    {
+      GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+      cc->qs = qs;
+      return GNUNET_SYSERR;
+    }
+    return GNUNET_OK;
+  }
   qs = TALER_ARL_get_denomination_info (old_denom_pub,
                                         &issue,
                                         &h_denom_pub);
-- 
2.47.3

Required notifications

Address or linkRemarkAdded byNotifiedActions

Relationships

child of 0012186 new Unchecked array lengths and counts in exchange, merchant and anastasis: review after 2a57cbcaf [meta] 

Activities

Christian Grothoff

2026-11-18 16:46

manager   ~0030607

027bbade0..6d4e8e152

Issue History

Date ModifiedUsernameFieldChange
2026-11-18 16:41bot-cgNew Issue
2026-11-18 16:41bot-cgRelationship addedchild of 0012186
2026-11-18 16:41bot-cgImplementer => oec
2026-11-18 16:41bot-cgReviewer => Christian Grothoff
2026-11-18 16:41bot-cgRelease signed by => Antoine A
2026-11-18 16:41bot-cgDeployed by => Christian Grothoff
2026-11-18 16:41bot-cgVerifier => oec
2026-11-18 16:41bot-cgCommunicator => CM_7
2026-11-18 16:41bot-cgFile Added: 12215-auditor-refuse-melts-with-an-impossible-number-of-fr.patch
2026-11-18 16:46Christian GrothoffStatusnew => closed
2026-11-18 16:46Christian GrothoffResolutionopen => fixed
2026-11-18 16:46Christian GrothoffFixed in Version => 1.6
2026-11-18 16:46Christian GrothoffNote Added: 0030607
2026-11-18 16:46Christian GrothoffTarget Version => 1.6