Vulnerabilities in pkg:npm/google-translate-api-browser

PACKAGE
Advisory Identifier: GHSA-4233-7q5q-m7p6
Advisory Summary

CVE-2023-48711 is a LOW (CVSS 3.7) google-translate-api-browser server-side request forgery (ssrf) vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Google translate api browser libraries in the npm ecosystem. The issue involves google-translate-api-browser server-side request forgery (ssrf) vulnerability. Remediation is available by upgrading affected packages to version 4.1.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/google-translate-api-browser

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/google-translate-api-browser. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-4233-7q5q-m7p6 CVE-2023-48711 LOW google-translate-api-browser Server-Side Request Forgery (SSRF) Vulnerability

CVE-2023-48711 at a Glance

CVE Identifier CVE-2023-48711
GHSA Identifier GHSA-4233-7q5q-m7p6
Severity LOW
CVSS v3.1 Base Score 3.7
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product Google translate api browser
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 3.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-48711

To remediate this vulnerability, upgrade all affected Google translate api browser dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

google-translate-api-browser fixed: 4.1.0
npm install google-translate-api-browser@4.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls google-translate-api-browser

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2023-48711, inspect your project dependencies using npm:

npm ls google-translate-api-browser

Analyze the terminal output to locate any version of Google translate api browser in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.1.0), your application is affected.

Note: The npm ls google-translate-api-browser command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In Google translate api browser, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A Server-Side Request Forgery (SSRF) Vulnerability is present in applications utilizing the `google-translate-api-browser` package and exposing the `translateOptions` to the end user. An attacker can set a malicious `tld`, causing the application to return unsafe URLs pointing towards local resources. ### Details The `translateOptions.tld` field is not properly sanitized before being placed in the Google translate URL. This can allow an attacker with control over the `translateOptions` to set the `tld` to a payload such as `@127.0.0.1`. This causes the full URL to become `https://translate.google.@127.0.0.1/...`, where `translate.google.` is the username used to connect to localhost. ### PoC Imagine a server running the following code (closely mimicking the code present in the package's README): ```javascript const express = require('express'); const { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser'); const https = require('https'); const app = express(); app.use(express.json()); app.post('/translate', async (req, res) => { const { text, options } = req.body; const url = generateRequestUrl(text, options); https.get(url, (resp) => { let data = ''; resp.on('data', (chunk) => { data += chunk; }); resp.on('end', () => { res.json(normaliseResponse(JSON.parse(data))); }); }).on("error", (err) => { console.log("Error: " + err.message); }); }); const port = 3000; app.listen(port, () => { console.log(`Server is running on port ${port}`); }); ``` An attacker can then send the following POST request to `/translate`: ``` POST /translate HTTP/1.1 Host: localhost:3000 Content-Type: application/json Content-Length: 51 {"text":"Hello","options": {"tld": "@127.0.0.1"} } ``` This will cause a request to be sent to the localhost of the server running the Node application. ### Impact An attacker can send requests within internal networks and the local host. Should any HTTPS application be present on the internal network with a vulnerability exploitable via a GET call, then it would be possible to exploit this using this vulnerability.

CVE-2023-48711 Affected Google translate api browser Versions

1 component(s)
Fixed Versions:
4.1.0
Product / Package Ecosystem Affected Versions Fixed Version
google-translate-api-browser
npm
< 4.1.0
4.1.0

References

Frequently Asked Questions

What is CVE-2023-48711?
CVE-2023-48711 is a security vulnerability in Google translate api browser involving google-translate-api-browser Server-Side Request Forgery (SSRF) Vulnerability under CWE-918: Server-Side Request Forgery (SSRF).
Which Google translate api browser versions are affected?
Affected versions include releases prior to 4.1.0 across affected packages: google-translate-api-browser.
What version fixes CVE-2023-48711?
Upgrading to 4.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is google-translate-api-browser affected?
Yes, google-translate-api-browser is affected in releases prior to 4.1.0. Upgrade your dependency to 4.1.0 or later.
What is the CVSS score of CVE-2023-48711?
CVE-2023-48711 has a CVSS v3.1 base score of 3.7 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2023-48711?
CVE-2023-48711 is classified under CWE-918: Server-Side Request Forgery (SSRF) (The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.).
How can I check npm dependencies for CVE-2023-48711?
Run the dependency tree command: 'npm ls google-translate-api-browser'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4233-7q5q-m7p6",
  "modified" : "2023-11-27T23:30:14Z",
  "published" : "2023-11-27T23:30:14Z",
  "aliases" : [ "CVE-2023-48711" ],
  "summary" : "google-translate-api-browser Server-Side Request Forgery (SSRF) Vulnerability",
  "details" : "### Summary\nA Server-Side Request Forgery (SSRF) Vulnerability is present in applications utilizing the `google-translate-api-browser` package and exposing the `translateOptions` to the end user. An attacker can set a malicious `tld`, causing the application to return unsafe URLs pointing towards local resources.\n\n### Details\nThe `translateOptions.tld` field is not properly sanitized before being placed in the Google translate URL. This can allow an attacker with control over the `translateOptions` to set the `tld` to a payload such as `@127.0.0.1`. This causes the full URL to become `https://translate.google.@127.0.0.1/...`, where `translate.google.` is the username used to connect to localhost.\n\n### PoC\nImagine a server running the following code (closely mimicking the code present in the package's README):\n```javascript\nconst express = require('express');\nconst { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser');\nconst https = require('https');\n\nconst app = express();\napp.use(express.json());\n\napp.post('/translate', async (req, res) => {\n    const { text, options } = req.body;\n\n    const url = generateRequestUrl(text, options);\n\n    https.get(url, (resp) => {\n        let data = '';\n      \n        resp.on('data', (chunk) => {\n          data += chunk;\n        });\n      \n        resp.on('end', () => {\n            res.json(normaliseResponse(JSON.parse(data)));\n        });\n      }).on(\"error\", (err) => {\n        console.log(\"Error: \" + err.message);\n      });\n});\n\nconst port = 3000;\napp.listen(port, () => {\n  console.log(`Server is running on port ${port}`);\n});\n```\n\nAn attacker can then send the following POST request to `/translate`:\n```\nPOST /translate HTTP/1.1\nHost: localhost:3000\nContent-Type: application/json\nContent-Length: 51\n\n{\"text\":\"Hello\",\"options\": {\"tld\": \"@127.0.0.1\"}  }\n```\n\nThis will cause a request to be sent to the localhost of the server running the Node application.\n\n### Impact\nAn attacker can send requests within internal networks and the local host. Should any HTTPS application be present on the internal network with a vulnerability exploitable via a GET call, then it would be possible to exploit this using this vulnerability.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "google-translate-api-browser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cjvnjde/google-translate-api-browser/security/advisories/GHSA-4233-7q5q-m7p6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-48711"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cjvnjde/google-translate-api-browser/commit/33c2eac4a21c6504409e7b06dd16e6346f93d34b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cjvnjde/google-translate-api-browser"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-11-27T23:30:14Z",
    "nvd_published_at" : "2023-11-24T17:15:07Z"
  }
}