Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
工具/GitHubGitHub/halcy0nic/cve-2022-44318
漏洞分析代码分析漏洞利用模糊测试学习与教育二进制利用
GitHubhalcy0nic/cve-2022-44318

CVE-2022-44318

CVE-2022-44318 的概念验证

查看仓库
113年前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2022-44318 描述

发现 PicoC 3.2.2 版本在 cstdlib/string.c 的 StringStrcat 函数中,当从 ExpressionParseFunctionCall 调用时存在堆缓冲区溢出漏洞。任何使用 Picoc 的项目或库也会受到此问题的影响。例如 picoc-js。

搭建实验环境

要复现 PicoC 中的堆溢出漏洞,我们首先需要下载并编译存在漏洞版本(v3.2.2)的 PicoC 库和解释器:

root@kitploit:~
git clone https://github.com/jpoirier/picoc.git
cd picoc
git checkout a97d94fa3d4d35c6b78b7de69faac7643e34de22
make

复现步骤

以脚本模式针对本仓库中包含的 StringStrcat_heap_overflow.c 文件执行解释器:

root@kitploit:~
$ ./picoc -s StringStrcat_heap_overflow.c

程序将发生段错误(segfault)并崩溃。这是库或解释器未捕获或未处理的堆溢出所导致的结果。我们可以使用地址消毒器(ASAN)重新编译项目,以便更清楚地了解溢出发生的位置。让我们在 Makefile 的 CFLAGS 变量中添加 -fsanitize=address 并重新编译该库:

root@kitploit:~
CFLAGS=-Wall -g -std=gnu11 -pedantic -DUNIX_HOST -DVER=\"`git show-ref --abbrev=8 --head --hash head`\" -DTAG=\"`git describe --abbrev=0 --tags`\" -fsanitize=address

重新编译库和解释器(在 picoc 根目录下):

root@kitploit:~
make clean
make

当我们执行程序时,ASAN 会输出以下结果,向我们展示堆缓冲区溢出发生在 StringStrcat cstdlib/string.c 第 40 行:

ASAN 输出:

root@kitploit:~
==308939==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x606000000892 at pc 0x7f489c03a590 bp 0x7ffc052778f0 sp 0x7ffc052770a0
WRITE of size 26 at 0x606000000892 thread T0
    #0 0x7f489c03a58f in __interceptor_strcat ../../../../src/libsanitizer/asan/asan_interceptors.cpp:392
    #1 0x55facf0eb418 in StringStrcat cstdlib/string.c:40
    #2 0x55facf0d4edd in ExpressionParseFunctionCall /dev/shm/picoc/expression.c:1909
    #3 0x55facf0d237c in ExpressionParse /dev/shm/picoc/expression.c:1607
    #4 0x55facf0c66a0 in ParseStatement /dev/shm/picoc/parse.c:646
    #5 0x55facf0c8380 in PicocParse /dev/shm/picoc/parse.c:897
    #6 0x55facf0e0d0e in PicocPlatformScanFile platform/platform_unix.c:129
    #7 0x55facf0b7213 in main /dev/shm/picoc/picoc.c:62
    #8 0x7f489be46189 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #9 0x7f489be46244 in __libc_start_main_impl ../csu/libc-start.c:381
    #10 0x55facf0b6d40 in _start (/dev/shm/picoc/picoc+0x16d40)

0x606000000892 is located 0 bytes to the right of 50-byte region [0x606000000860,0x606000000892)
allocated by thread T0 here:
    #0 0x7f489c0ae987 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x55facf0d5b80 in HeapAllocMem /dev/shm/picoc/heap.c:127
    #2 0x55facf0da3a9 in VariableAlloc /dev/shm/picoc/variable.c:77
    #3 0x55facf0da429 in VariableAllocValueAndData /dev/shm/picoc/variable.c:97
    #4 0x55facf0da701 in VariableAllocValueFromType /dev/shm/picoc/variable.c:119
    #5 0x55facf0dbaa7 in VariableDefine /dev/shm/picoc/variable.c:303
    #6 0x55facf0dc6aa in VariableDefineButIgnoreIdentical /dev/shm/picoc/variable.c:383
    #7 0x55facf0c4540 in ParseDeclaration /dev/shm/picoc/parse.c:366
    #8 0x55facf0c6f6e in ParseStatement /dev/shm/picoc/parse.c:738
    #9 0x55facf0c8380 in PicocParse /dev/shm/picoc/parse.c:897
    #10 0x55facf0e0d0e in PicocPlatformScanFile platform/platform_unix.c:129
    #11 0x55facf0b7213 in main /dev/shm/picoc/picoc.c:62
    #12 0x7f489be46189 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: heap-buffer-overflow ../../../../src/libsanitizer/asan/asan_interceptors.cpp:392 in __interceptor_strcat
Shadow bytes around the buggy address:
  0x0c0c7fff80c0: fa fa fa fa fd fd fd fd fd fd fd fa fa fa fa fa
  0x0c0c7fff80d0: 00 00 00 00 00 00 06 fa fa fa fa fa 00 00 00 00
  0x0c0c7fff80e0: 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 05 fa
  0x0c0c7fff80f0: fa fa fa fa 00 00 00 00 00 00 02 fa fa fa fa fa
  0x0c0c7fff8100: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
=>0x0c0c7fff8110: 00 00[02]fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8140: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8150: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8160: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==308939==ABORTING

存在漏洞的源代码:

root@kitploit:~
void StringStrcat(struct ParseState *Parser, struct Value *ReturnValue,
    struct Value **Param, int NumArgs)
{
    ReturnValue->Val->Pointer = strcat(Param[0]->Val->Pointer,
        Param[1]->Val->Pointer);
}

参考链接

  • https://cwe.mitre.org/data/definitions/122.html
  • https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-44318
下载工具