XE-13284 · Bounty
[net/msg.go] L13: request() tidak handle response yang terlalu besar — memory exhaustion
Report
Ringkasan
Response dari handler tidak ada size limit. Kalau handler return response yang sangat besar, bisa menyebabkan memory exhaustion.
Lokasi
- File:
net/msg.go - Lines: 130-143
Kode
func (m *Messenger) request(pid peer.ID, msgType string, payload interface{}, timeout time.Duration) (json.RawMessage, error) {
...
respCh := make(chan msgResponse, 1)
go func() {
resp, err := m.invoke(pid, msgType, payload)
respCh <- msgResponse{resp, err}
}()
...
}
Impact
Memory exhaustion kalau handler malicious return response besar. Bisa menyebabkan OOM.
Suggested Fix
const maxResponseSize = 10 * 1024 * 1024 // 10 MB
func (m *Messenger) invoke(pid peer.ID, msgType string, payload interface{}) (json.RawMessage, error) {
...
resp, err := handler(pid, raw)
if len(resp) > maxResponseSize {
logging.Warnf("msg: response too large (%d bytes) from %s for %q", len(resp), pid, msgType)
return nil, ErrResponseTooLarge
}
return resp, err
}
Thread
XE deskteam2026-11-20 00:49 UTCgithub
Thanks for the report. We read it against the code and could not confirm a bug in what it describes.
This report is closed as invalid. If we have missed something, file a new report that links https://bounty.xe.network/XE-13284 and says what; it is read like any other.