Baja

Taylor has race condition in /get-patch that allows purchase token replay

  • Publicada: 27.06.2025
  • Actualizado: 11.10.2026 10:22

Hi team,

I was looking at the recent fix and you limited the exploitability of race conditions but unfortunately it is still possible to exploit the issue since two requests happening at the exact same time will still go through. You should be able to completely fix the race conditions by leveraging SQLITE write lock and just send one query.

Summary

The /get-patch endpoint processes a purchase in two separate database queries: a SELECT that verifies the token is unused, followed by an UPDATE that marks the token as used. Because SQLite only guards each statement, a malicious actor can issue two requests at the exact same moment and have both SELECT statements succeed before either UPDATE runs.

Details

The handler executes (step 1):

SELECT id, token_used_at FROM purchases WHERE patch_id = ? AND purchase_token = ? AND status = 'COMPLETED'

If token_used_at IS NULL, the request passes the check (step 2):

        if (row.token_used_at) {
            return res.status(403).json({ error: "Purchase token has already been used." });
        }

The handler finally runs (step 3):

UPDATE purchases SET token_used_at = CURRENT_TIMESTAMP WHERE id = ?

When two requests arrive at the same time, they both finish step 1 while the row is still unused. SQLite serializes writers only per statement, so each request believes it has exclusive access. Both decrypt and return the patch, and both UPDATE statements succeed.

PoC

To perform this attack, you need to send two requests at the exact same time.

Impact

An attacker who possesses a valid purchase token can replay it and receive multiple copies of the paid patch, or distribute one copy while still keeping their own. This results in revenue loss and undermines license enforcement.

Remediation

Replace the read-then-write sequence with a single atomic statement that both validates and consumes the token while SQLite holds the write lock:

const row = db.prepare(`
  UPDATE purchases
     SET token_used_at = CURRENT_TIMESTAMP
   WHERE patch_id       = ?
     AND purchase_token = ?
     AND status         = 'COMPLETED'
     AND token_used_at IS NULL
  RETURNING id;
`).get(patchId, token);

if (!row) return res.status(403).json({ error: 'Invalid or already-used token.' });

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de npm taylored < 8.1.3 8.1.3

Referencias

Puntuación CVSS -
Debilidad (CWE)
CWE-362
Plataforma
npm
Paquete
taylored
Publicada
27.06.2025
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-vh5j-5fhq-9xwg - CC BY 4.0

Historial de vulnerabilidades: taylored

Todas las vulnerabilidades publicadas de este paquete (Paquete de npm), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Entradas en total
2
Primera → última
06.2025 06.2025
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Crítica 1
  • Baja 1

Divulgaciones por año

  1. 2025: 2
  2. 2026: 0
  1. Taylor has race condition in /get-patch that allows purchase token replay esta entrada
    Baja ghsa-vh5j-5fhq-9xwg < 8.1.3 8.1.3
  2. Crítica ghsa-8g98-m4j9-qww5 >= 7.0.5, < 7.0.8 7.0.8

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.