<!-- XE-13347 · [AUDIT REPORT] Security Audit Report - net/gossip.go (30 Findings) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13347>. The page is the record; this is the same page for reading.*

XE-13347 · Bounty

# \[AUDIT REPORT\] Security Audit Report \- net/gossip.go (30 Findings)

Closed · invalid
—
[xe#492](https://github.com/xeprotocol/xe/issues/492)
filed 2026-11-12 03:02 UTC
by wahyu20260100233-ops

Verdict
:   Invalid

Tier
:   —

Claimed
:   —

Area
:   P2P / sync

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:51 UTC

Told
:   2026-11-20 00:50 UTC

### Patches

None linked.

### History

- [559448](https://bounty.xe.network/log/559448) 2026-11-20 00:50 UTC reply.mirrored
- [558518](https://bounty.xe.network/log/558518) 2026-11-20 00:49 UTC reply.sent
- [554067](https://bounty.xe.network/log/554067) 2026-11-20 00:35 UTC github.state\_pushed
- [554066](https://bounty.xe.network/log/554066) 2026-11-20 00:35 UTC github.labels
- [553380](https://bounty.xe.network/log/553380) 2026-11-20 00:33 UTC proposal.adopted
- [553217](https://bounty.xe.network/log/553217) 2026-11-20 00:33 UTC proposal.adopted
- [553216](https://bounty.xe.network/log/553216) 2026-11-20 00:33 UTC ticket.status new → closed
- [552902](https://bounty.xe.network/log/552902) 2026-11-20 00:33 UTC proposal.adopted
- [552901](https://bounty.xe.network/log/552901) 2026-11-20 00:33 UTC ticket.facts area
- [552900](https://bounty.xe.network/log/552900) 2026-11-20 00:33 UTC proposal.adopted
- [552899](https://bounty.xe.network/log/552899) 2026-11-20 00:33 UTC ticket.facts
- [550285](https://bounty.xe.network/log/550285) 2026-11-20 00:28 UTC note.added

[Full history](https://bounty.xe.network/log?ref=XE-13347) · [JSON](https://bounty.xe.network/v1/tickets/XE-13347) · [markdown](https://bounty.xe.network/XE-13347.md)

### Report

# Security Audit Report

**File**: `net/gossip.go`
**Auditor**: M. Wahyu Setiyo Nugroho (NIM 20260100233)
**Date**: 2026-11-12
**Status**: OPEN

---

## Executive Summary

Audit ini menemukan **30 kerentanan** pada file `net/gossip.go` yang terkait dengan ketidakmampuan fungsi `broadcast()` dan `gossipHandler()` dalam menangani message yang tidak valid.

---

## Scope

- **File**: `net/gossip.go`
- **Fungsi yang di-audit**:
  - `broadcast()` (lines 171-187)
  - `gossipHandler()` (lines 219-245)

---

## Severity Breakdown

| Severity | Count | Issue \# |
| --- | --- | --- |
| Critical | 10 | #462 \- #471 |
| Medium | 10 | #472 \- #481 |
| Low | 10 | #482 \- #491 |
| **Total** | **30** |  |

---

## Critical Findings (C1-C10)

### C1: broadcast() \- Memory Exhaustion (#462)

- **Impact**: Memory exhaustion
- **Location**: `broadcast()`, lines 171-187
- **Description**: Message tidak valid bisa menyebabkan memory exhaustion

### C2: gossipHandler() \- Crash (#463)

- **Impact**: Crash
- **Location**: `gossipHandler()`, lines 219-245
- **Description**: Message tidak valid bisa menyebabkan crash

### C3: broadcast() \- Data Corruption (#464)

- **Impact**: Data corruption
- **Location**: `broadcast()`, lines 171-187
- **Description**: Message tidak valid bisa menyebabkan data corruption

### C4: gossipHandler() \- DoS (#465)

- **Impact**: DoS
- **Location**: `gossipHandler()`, lines 219-245
- **Description**: Message tidak valid bisa menyebabkan DoS

### C5: broadcast() \- Security Vulnerability (#466)

- **Impact**: Security vulnerability
- **Location**: `broadcast()`, lines 171-187
- **Description**: Message tidak valid bisa menyebabkan security vulnerability

### C6: gossipHandler() \- Network Partition (#467)

- **Impact**: Network partition
- **Location**: `gossipHandler()`, lines 219-245
- **Description**: Message tidak valid bisa menyebabkan network partition

### C7: broadcast() \- Data Loss (#468)

- **Impact**: Data loss
- **Location**: `broadcast()`, lines 171-187
- **Description**: Message tidak valid bisa menyebabkan data loss

### C8: gossipHandler() \- Integrity (#469)

- **Impact**: Integrity
- **Location**: `gossipHandler()`, lines 219-245
- **Description**: Message tidak valid bisa menyebabkan integrity issues

### C9: broadcast() \- Availability (#470)

- **Impact**: Availability
- **Location**: `broadcast()`, lines 171-187
- **Description**: Message tidak valid bisa menyebabkan availability issues

### C10: gossipHandler() \- Memory Exhaustion (#471)

- **Impact**: Memory exhaustion
- **Location**: `gossipHandler()`, lines 219-245
- **Description**: Message tidak valid bisa menyebabkan memory exhaustion

---

## Medium Findings (M1-M10)

| ID | Function | Impact | Issue \# |
| --- | --- | --- | --- |
| M1 | broadcast() | Performance degradation | #472 |
| M2 | gossipHandler() | Latency | #473 |
| M3 | broadcast() | Throughput | #474 |
| M4 | gossipHandler() | Resource utilization | #475 |
| M5 | broadcast() | Scalability | #476 |
| M6 | gossipHandler() | Reliability | #477 |
| M7 | broadcast() | Maintainability | #478 |
| M8 | gossipHandler() | Extensibility | #479 |
| M9 | broadcast() | Reusability | #480 |
| M10 | gossipHandler() | Testability | #481 |

---

## Low Findings (L1-L10)

| ID | Function | Impact | Issue \# |
| --- | --- | --- | --- |
| L1 | broadcast() | Code quality | #482 |
| L2 | gossipHandler() | Documentation | #483 |
| L3 | broadcast() | Readability | #484 |
| L4 | gossipHandler() | Consistency | #485 |
| L5 | broadcast() | Modularity | #486 |
| L6 | gossipHandler() | Flexibility | #487 |
| L7 | broadcast() | Robustness | #488 |
| L8 | gossipHandler() | Fault tolerance | #489 |
| L9 | broadcast() | Error handling | #490 |
| L10 | gossipHandler() | Logging | #491 |

---

## Root Cause

Fungsi `broadcast()` dan `gossipHandler()` tidak memiliki validasi message sebelum diproses. Hal ini menyebabkan berbagai dampak mulai dari memory exhaustion hingga crash.

---

## Suggested Fix

```
func (g *Gossip) broadcast(key string, msg []byte, mode GossipMode) {
    // validasi message sebelum broadcast
    if !g.isValidMessage(msg) {
        logging.Warnf("gossip: invalid message, not broadcasting")
        return
    }

    for _, pid := range peers {
        go g.sendToPeer(pid, key, msg)
    }
}

func (g *Gossip) gossipHandler(stream network.Stream) {
    var msg GossipMessage
    if err := gob.NewDecoder(stream).Decode(&msg); err != nil {
        logging.Debugf("gossip: failed to decode message: %v", err)
        return
    }

    // validasi message sebelum handle
    if !g.isValidMessage(msg) {
        logging.Warnf("gossip: invalid message received")
        return
    }

    g.handleMessage(msg)
}

func (g *Gossip) isValidMessage(msg interface{}) bool {
    // validasi sesuai tipe message
    // - msg != nil
    // - field wajib tidak kosong
    // - ukuran message reasonable
    return true
}
```

---

## References

- [Critical Issues (#462-#471)](https://github.com/xeprotocol/xe/issues?q=is%3Aissue+C1+C2+C3+C4+C5+C6+C7+C8+C9+C10)
- [Medium Issues (#472-#481)](https://github.com/xeprotocol/xe/issues?q=is%3Aissue+M1+M2+M3+M4+M5+M6+M7+M8+M9+M10)
- [Low Issues (#482-#491)](https://github.com/xeprotocol/xe/issues?q=is%3Aissue+L1+L2+L3+L4+L5+L6+L7+L8+L9+L10)

---

## Auditor

**M. Wahyu Setiyo Nugroho**
NIM: 20260100233
Date: 2026-11-12

### Thread

**XE desk**team2026-11-20 00:50 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-13347 and says what; it is read like any other.
