c++ - 从已编译的 C++ 代码中提取 int 数组

标签 c++ security

攻击者是否有可能从您的编译代码中获取整数数组?

比如攻击者如何使用 strings 命令从您的代码中获取字符串。

最佳答案

是的。 main.c 的简单示例:

int main(void) {
        int vars[8] = {0,1,2,3,4,5,6,7};
}

然后 gcc -O0 main.c -o main 禁用优化,这样我们未使用的数组就不会被删除。那么如果你简单地拆解它:

0000000000400474 <main>:
  400474:       55                      push   %rbp
  400475:       48 89 e5                mov    %rsp,%rbp
  400478:       c7 45 e0 00 00 00 00    movl   $0x0,-0x20(%rbp)
  40047f:       c7 45 e4 01 00 00 00    movl   $0x1,-0x1c(%rbp)
  400486:       c7 45 e8 02 00 00 00    movl   $0x2,-0x18(%rbp)
  40048d:       c7 45 ec 03 00 00 00    movl   $0x3,-0x14(%rbp)
  400494:       c7 45 f0 04 00 00 00    movl   $0x4,-0x10(%rbp)
  40049b:       c7 45 f4 05 00 00 00    movl   $0x5,-0xc(%rbp)
  4004a2:       c7 45 f8 06 00 00 00    movl   $0x6,-0x8(%rbp)
  4004a9:       c7 45 fc 07 00 00 00    movl   $0x7,-0x4(%rbp)

这是合乎逻辑的,如果你的代码中有数据并且你的程序使用它,那么数据一定存在于某处。

关于c++ - 从已编译的 C++ 代码中提取 int 数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35306680/

相关文章:

linux - 网络统计 : How to know if it's Human or Bot/Spider/DDOS

security - secret 与非 secret 初始化向量

security - Symfony2 通过 IP 保护不工作

security - 使用 JWT 受众字段进行授权角色

c++ - 无法包含 winhttp.h (带有代码::blocks/mingw)c++

c++ - 在 C++ 中将特定格式的数字转换为 long/double

c++ - 将 double 类型转换为 unsigned long long 类型导致来自 Windows 和 Linux 的 C++

c++ - 在 map 中使用前类的前向声明错误

c++ float to string non-fixed precision after decimal

php - PHP 中的安全问题和架构