Improper Input Validation Affecting translate package, versions <3.0.0
Threat Intelligence
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 ID SNYK-JS-TRANSLATE-6483248
- published 24 Mar 2024
- disclosed 22 Mar 2024
- credit PinkDraconian
Introduced: 22 Mar 2024
CVE-2024-29042 Open this link in a new tabHow 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"}}