diff --git a/common/chat-peg-parser.cpp b/common/chat-peg-parser.cpp index a4818859a6..7f3319d9f8 100644 --- a/common/chat-peg-parser.cpp +++ b/common/chat-peg-parser.cpp @@ -420,6 +420,7 @@ void common_chat_peg_mapper::map(const common_peg_ast_node & node) { result.tool_calls.push_back(pending_tool_call.value()); } pending_tool_call.reset(); + current_tool = nullptr; } } } diff --git a/docs/eliza-security-advisories.md b/docs/eliza-security-advisories.md new file mode 100644 index 0000000000..0de4327953 --- /dev/null +++ b/docs/eliza-security-advisories.md @@ -0,0 +1,26 @@ +# Eliza fork: upstream security advisories + +This fork is based on ggml-org llama.cpp `b9159`. Upstream security fixes +reach it only by a rebase or a cherry-pick. Before you move the elizaOS +`plugins/plugin-local-inference/native/llama.cpp` gitlink to a new fork +commit, do these steps: + +1. Read the ggml-org advisories: + `gh api repos/ggml-org/llama.cpp/security-advisories`. +2. Search OSV for llama.cpp CVEs that are not in that list (many are filed + only as CVEs): `https://api.osv.dev/v1/query` with the package + `github.com/ggml-org/llama.cpp`. +3. For each fix commit, check `git merge-base --is-ancestor HEAD`. + If it is missing, cherry-pick it with `git cherry-pick -x`. +4. Update the table below. + +Keep `GGML_RPC` off in every Eliza build. The RPC server has an open +unauthenticated remote code execution advisory with no upstream fix. + +| Advisory | Component | Status in this fork | +| --- | --- | --- | +| CVE-2026-107183 (use-after-free, chat PEG parser) | `common/chat-peg-parser.cpp` | Fixed: cherry-pick of ggml-org `dbe4c3e` (#29942). | +| CVE-2026-52132 (`/rerank` negative `top_n`, DoS) | `tools/server` | Fixed in the fork: a negative `top_n` returns HTTP 400. No ggml-org fix yet. | +| GHSA-j8rj-fmpv-wcxw / CVE-2026-34159 (RPC `GRAPH_COMPUTE`, RCE) | `ggml-rpc` | No upstream fix. Not built: `GGML_RPC` is off. | +| CVE-2026-86317 (RPC `deserialize_tensor` assertion) | `ggml-rpc` | No upstream fix. Not built: `GGML_RPC` is off. | +| GGUF parser and tokenizer advisories up to GHSA-96jg-mvhq-q7q7 | `ggml/src/gguf.cpp`, `src/llama-vocab.cpp` | Fixed in the `b9159` base. | diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp index c8fc91c437..cebf8df8a7 100644 --- a/tools/server/server-context.cpp +++ b/tools/server/server-context.cpp @@ -4597,6 +4597,11 @@ void server_routes::init_routes() { } int top_n = json_value(body, "top_n", (int)documents.size()); + if (top_n < 0) { + // a negative top_n made format_response_rerank resize to a huge size (CVE-2026-52132) + res->error(format_error_response("\"top_n\" must be a non-negative integer", ERROR_TYPE_INVALID_REQUEST)); + return res; + } // create and queue the task json responses = json::array(); diff --git a/tools/server/tests/unit/test_rerank.py b/tools/server/tests/unit/test_rerank.py index ded8267109..972f3c84b8 100644 --- a/tools/server/tests/unit/test_rerank.py +++ b/tools/server/tests/unit/test_rerank.py @@ -81,6 +81,19 @@ def test_invalid_rerank_req(documents): assert "error" in res.body +@pytest.mark.parametrize("field", ["documents", "texts"]) +def test_rerank_negative_top_n(field): + global server + server.start() + res = server.make_request("POST", "/rerank", data={ + "query": "Machine learning is", + field: TEST_DOCUMENTS, + "top_n": -1, + }) + assert res.status_code == 400 + assert "error" in res.body + + @pytest.mark.parametrize( "query,doc1,doc2,n_tokens", [