Live data from Hacker News

Try to make sudo less vulnerable to Rowhammer attacks

github.com

41–50 of 147 posts

Re: Try to make sudo less vulnerable to Rowhammer attacks

#41

Is there any reason for the void cast here? Theres no return value in use. (void)strlcpy(des_pass, pass,sizeof(des_pass));

strlcpy returns a size_t, so just to silence the discarded return value warning https://linux.die.net/man/3/strlcpy

Sure; it's just irrelevant to the diff's logical change.

Re: Try to make sudo less vulnerable to Rowhammer attacks

#42

i enjoyed this part: #define AUTH_SUCCESS 0x52a2925 /\* 0101001010100010100100100101 */ #define AUTH_FAILURE 0xad5d6da /* 1010110101011101011011011010 */ #define AUTH_INTR 0x69d61fc8 /* 1101001110101100001111111001000 */ #define AUTH_ERROR 0x1629e037 /* 0010110001010011110000000110111 */ #define AUTH_NONINTERACTIVE 0x1fc8d3ac /* 11111110010001101001110101100 \*/ going to see how i can work this into a project :)

I don't get it, what's special about these numbers?

Takes many bit flips to go from one pattern to another.

Re: Try to make sudo less vulnerable to Rowhammer attacks

#43

i enjoyed this part: #define AUTH_SUCCESS 0x52a2925 /\* 0101001010100010100100100101 */ #define AUTH_FAILURE 0xad5d6da /* 1010110101011101011011011010 */ #define AUTH_INTR 0x69d61fc8 /* 1101001110101100001111111001000 */ #define AUTH_ERROR 0x1629e037 /* 0010110001010011110000000110111 */ #define AUTH_NONINTERACTIVE 0x1fc8d3ac /* 11111110010001101001110101100 \*/ going to see how i can work this into a project :)

> I enjoyed this part

Very nice indeed. Such a simple mitigation and it makes evil people sad, which makes me happy.

Re: Try to make sudo less vulnerable to Rowhammer attacks

#44
post #42

Earlier quoted context omitted.

I don't get it, what's special about these numbers?

Takes many bit flips to go from one pattern to another.

If that is the only constraint, wouldn't the goal be to be as far as possible from the only success state?

the distance between success and failure is 28

Re: Try to make sudo less vulnerable to Rowhammer attacks

#45
post #19

I thought that Rowhammer was a thing of the past. Out of curiosity I found code to test for this and ran it on some of my hosts. My old desktop - I7-4770K/DDR3 - was susceptible. My old server - Xeon X3460/DDR3+ECC - was not. I upgraded the desktop with components based on a Ryzen 7 7700X/DDR5. It tested not susceptible. I'm not sure if that's a result of RAM designed not to be susceptible or that (I think) DDR5 RAM…

LPDDR4 and above are supposed to have a feature to detect too many accesses to the same few rows and initiate a refresh cycle. Implementation quality may vary.

Re: Try to make sudo less vulnerable to Rowhammer attacks

#47
post #37

Earlier quoted context omitted.

From the commit: “The values used were chosen such that it takes a large number of bit flips to change from allowed to denied. Using random values doesn't really protect against this attack.” It would be neat to see an algorithm that generates suitable values.

The basic algorithm for the 2-enum case from the commit seems to just be `enum { A = rand(), B = ~A}`. Although I'm not sure if it's optimal, the many case seems to be the same as the 2-case but repeated for every 2 items. I expect they double checked that the amount of bitflips is still pretty high. Maybe a better algorithm for the many case would be something like the popcnt parallel patterns: * 0b0101010101010101…

The n=2 case also occurs in the commit: https://github.com/sudo-project/sudo/commit/7873f8334c8d3103...

And indeed, the two values ate bitwise complements.

Re: Try to make sudo less vulnerable to Rowhammer attacks

#49

i enjoyed this part: #define AUTH_SUCCESS 0x52a2925 /\* 0101001010100010100100100101 */ #define AUTH_FAILURE 0xad5d6da /* 1010110101011101011011011010 */ #define AUTH_INTR 0x69d61fc8 /* 1101001110101100001111111001000 */ #define AUTH_ERROR 0x1629e037 /* 0010110001010011110000000110111 */ #define AUTH_NONINTERACTIVE 0x1fc8d3ac /* 11111110010001101001110101100 \*/ going to see how i can work this into a project :)

> I enjoyed this part Very nice indeed. Such a simple mitigation and it makes evil people sad, which makes me happy.

This is for local sudo privilege escalation.

If the attacker is already running code on your system, you kind of lost anyway.

Re: Try to make sudo less vulnerable to Rowhammer attacks

#50
post #19

I thought that Rowhammer was a thing of the past. Out of curiosity I found code to test for this and ran it on some of my hosts. My old desktop - I7-4770K/DDR3 - was susceptible. My old server - Xeon X3460/DDR3+ECC - was not. I upgraded the desktop with components based on a Ryzen 7 7700X/DDR5. It tested not susceptible. I'm not sure if that's a result of RAM designed not to be susceptible or that (I think) DDR5 RAM…

Are you running the Ryzen DDR5 at stock speeds (4800 MT/s) or at some XMP profile.
Post reply on HN