T03 · Remote Payload Retrieval and Execution
- Location
smithnode-core/src/main.rs:1568- Finding
Automatic Remote Binary Replacement and Execution
- Content
View full analysis
{ match response.bytes().await { Ok(bytes) => { use sha2::{Sha256, Digest}; let mut hasher = Sha256::new(); hasher.update(&bytes); let computed_checksum = hex::encode(hasher.finalize()); if computed_checksum != checksum { tracing::warn!("⚠️ [{}] Checksum mismatch from {}", source, try_url); continue; } downloaded_bytes = Some(bytes.to_vec()); download_success = true; break; } Err(e) => { tracing::warn!("⚠️ [{}] Failed to read response: {}", source, e); continue; } } } Ok(response) => { tracing::warn!("⚠️ [{}] HTTP {}", source, response.status()); continue; } Err(e) => { tracing::warn!("⚠️ [{}] Download failed: {}", source, e); continue; } } let bytes = downloaded_bytes.unwrap(); match std::env::current_exe() { Ok(current_exe) => { let backup_path = current_exe.with_extension("old"); let new_path = current_exe.with_extension("new"); if let Err(e) = std::fs::write(&new_path, &bytes) { tracing::error!("❌ Failed to write new binary: {}", e); applied_version = Some(upgrade.version.clone()); continue; } #[cfg(unix)] { use std::os::unix::fs::PermissionsExt; let _ = std::fs::set_permissions( &new_path, std::fs::Permissions::from_mode(0o755), ); ...[truncated 3120 chars]- Remediation
View remediation
