我有这个C代码,我想知道如果可能如何绕过这个检查?
int fd, password, input;
fd = open("/dev/urandom", 0);
read(fd, &password, 4);
scanf("%d", &input);
if (password == input)
{
printf("OK\n")
}
或者是否可以预测urandom值?
不可以。无法预测/dev/urandom
在正常运行的系统上产生的值。
话虽如此,这里有可能出现错误:
/dev/urandom
可能被错误地创建,实际上指的是例如/dev/zero
或/dev/null