如何绕过/破解urandom值?

问题描述 投票:-3回答:1

我有这个C代码,我想知道如果可能如何绕过这个检查?

int fd, password, input;
fd = open("/dev/urandom", 0);
read(fd, &password, 4);
scanf("%d", &input);

if (password == input)
{
    printf("OK\n")
}

或者是否可以预测urandom值?

c random
1个回答
2
投票

不可以。无法预测/dev/urandom在正常运行的系统上产生的值。

话虽如此,这里有可能出现错误:

  • /dev/urandom可能被错误地创建,实际上指的是例如/dev/zero/dev/null
  • 您显示的代码中没有错误处理;无法打开或读取将无法检测到,保持密码值不变。
© www.soinside.com 2019 - 2024. All rights reserved.