CVE-2024-29042
JSON

5.3medium

Translate Cache Poisoning Vulnerability

Severity
5.3medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.65% (higher than 52% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-882j-4vj5-7vmj

Description

Translate is a package that allows users to convert text to different languages on Node.js and the browser. Prior to version 3.0.0, an attacker controlling the second variable of the `translate` function is able to perform a cache poisoning attack. They can change the outcome of translation requests made by subsequent users. The `opt.id` parameter allows the overwriting of the cache key. If an attacker sets the `id` variable to the cache key that would be generated by another user, they can choose the response that user gets served. Version 3.0.0 fixes this issue.

Affected

Product or packageVersionsReported by
franciscop translate< 3.0.0, before 3.0.0CVE List
translate (npm)before 3.0.0GitHub Advisory Database
francisco translatebefore 3.0.0NVD

All scores

GitHub_M5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
GitHub5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

Classification

CWE-20

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.

What each source says

CVE List

Translate is a package that allows users to convert text to different languages on Node.js and the browser. Prior to version 3.0.0, an attacker controlling the second variable of the `translate` function is able to perform a cache poisoning attack. They can change the outcome of translation requests made by subsequent users. The `opt.id` parameter allows the overwriting of the cache key. If an attacker sets the `id` variable to the cache key that would be generated by another user, they can choose the response that user gets served. Version 3.0.0 fixes this issue.

GitHub Advisory Database
Summary

An attacker controlling the second variable of the translate function is able to perform a cache poisoning attack. They can change the outcome of translation requests made by subsequent users.

Details

The opt.id parameter allows the overwriting of the cache key. If an attacker sets the id variable to the cache key that would be generated by another user, they can choose the response that user gets served.

PoC

Take the following simple server allowing users to supply text and the language to translate to.

import translate from "translate";
import express from 'express';

const app = express();
app.use(express.json());

app.post('/translate', async (req, res) => {
  const { text, language } = req.body;
  const result = await translate(text, language);
  return res.json(result);
});

const port = 3000;
app.listen(port, () => {
  console.log(`Server is running on port ${port}`);
});

We can send the following request to poison the cache:

{"text":"I hate you", "language":{"to":"nl","id":"undefined:en:nl:google:I love you"}}

Poisoning the cache

Now, any user that attempts to translate "I love you" to Dutch, will get "I hate you" in Dutch as the response. The victim gets our poisoned data

Impact

An attacker can control the results other users may get

NVD (es)

Translate es un paquete que permite a los usuarios convertir texto a diferentes idiomas en Node.js y el navegador. Antes de la versión 3.0.0, un atacante que controlaba la segunda variable de la función "traducir" podía realizar un ataque de envenenamiento de caché. Pueden cambiar el resultado de las solicitudes de traducción realizadas por usuarios posteriores. El parámetro `opt.id` permite sobrescribir la clave de caché. Si un atacante establece la variable `id` en la clave de caché que generaría otro usuario, puede elegir la respuesta que recibirá ese usuario. La versión 3.0.0 soluciona este problema.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-29042 changed 2024-08-02CVE Terms of Use
GitHub Advisory DatabaseGHSA-882j-4vj5-7vmj changed 2026-09-10CC-BY-4.0
NVDCVE-2024-29042 changed 2026-06-17Public domain