T09 · Insecure Skill Coding Practices
- Location
src/discovery.rs:71- Finding
Unauthenticated UDP Reflection and Amplification
- Content
View full analysis
result, Ok(Err(e)) => { tracing::debug!("discovery recv error: {e}"); continue; } Err(_) => continue, }; if len < PROBE_SIZE { continue; } if buf[..4] != PROBE_MAGIC { continue; } if buf[4] != PROBE_VERSION { continue; } if let Err(e) = self.send_response(src).await { tracing::debug!("failed to send discovery response to {src}: {e}"); } } tracing::info!("discovery listener stopped"); } async fn send_response(&self, dest: SocketAddr) -> Result<()> { let mut response = ScanResponse { node_id: self.node_id.clone(), name: self.name.clone(), version: self.version.clone(), capabilities: self.capabilities.clone(), quic_port: self.quic_port, }; let header_size = PROBE_SIZE; let max_payload = MAX_RESPONSE_SIZE - header_size; let mut payload = postcard::to_allocvec(&response) .context("failed to serialize scan response")?; while payload.len() > max_payload && !response.capabilities.is_empty() { response.capabilities.pop(); payload = postcard::to_allocvec(&response) .context("failed to serialize scan response")?; } if payload.len() > max_payload { respo ...[truncated 2720 chars]- Remediation
View remediation
