security - 如何远程利用 sprintf 代码漏洞
问题描述
#define PORT 7070
int exec_command(int sock, char *buf) {
char command[300];
// redirecting the stdout to the socket
close(STDOUT_FILENO);
dup2(sock, STDOUT_FILENO);
// The following line is different for each linux command to be executed.
sprintf(command, "/usr/bin/nslookup %s", buf);
system(command);
return 0;
}
所以假设我们有上面显示的代码片段,客户端输入一个 url 输入,让服务器对其进行 curl 搜索。我认为该漏洞与“sprintf”有关,问题是我尝试了多个输入来尝试提示服务器提供一些堆栈内存,但到目前为止都没有成功。有谁知道如何远程攻击这种类型的漏洞?
解决方案
推荐阅读
- javascript - 使用 async/await 承诺在“并行”中运行 for 循环
- react-native - npm install 和 codepush:上传的包没有发布,因为它与指定部署的当前发布的内容相同
- react-native - 反应原生灯箱没有缩放
- acumatica - 使用 Acumatica 中的参数运行 EXE
- r - data.table :将不存在的列“获取”到现有列会静默失败
- kotlin - Kotlin 中具有多个参数的完成块
- clickhouse - Clickhouse 无法在 red-hat 7.8 上启动,并出现错误“DNS 错误:EAI:不支持主机名的地址系列”
- c# - 从 mysql 反序列化 json 字符串并使用 C#.net 存储到结构中
- windows - 一个人如何成为微软生态系统中知名的软件制造商?
- python - Gensim 3.8.0 到 Gensim 4.0.0