Live data from Hacker News

Try to make sudo less vulnerable to Rowhammer attacks

github.com

81–90 of 147 posts

Re: Try to make sudo less vulnerable to Rowhammer attacks

#81

Even without an explicit attack, today's memory is pretty fragile, I'm regularly seeing bit flips.

> I'm regularly seeing bit flips. How?

For example 7zip decompression CRC failures that resolve on a second try. It would be longer to explain how, but I tracked it multiple times to a single bit flip in the decompressed output.

Re: Try to make sudo less vulnerable to Rowhammer attacks

#82
post #69

Given that the most common use of sudo is to give yourself root to run a command, and malware looking to elevate root can just rig up ~/.bashrc, what use is this patch? What use cases does it apply to and how common are they?

Haha I have done exactly that as a joke in highschool https://github.com/Visgean/fakesudo

Re: Try to make sudo less vulnerable to Rowhammer attacks

#83

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 :)

That's the section that made me post this snippet; crazy isn't it?!

can't edit original post, but i just realized after lining up the monospace how

  #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   */
AUTH_FAILURE is still just !AUTH_SUCCESS (and almost a palindrome)

Re: Try to make sudo less vulnerable to Rowhammer attacks

#84
post #77
post #71

Earlier quoted context omitted.

Have you ever seen any even moderately detailed specification of what the DRAM manufacturers do in this regard? I have not, and I looked. I am deeply sceptical .... I don't believe that Rowhammer mitigations happen inside the DRAM chips themselves, I think that they are being put into the memory controller that talks to DRAM. Since DRAMs with built-in Rowhammer defences would have to spend transistors on this defence…

It makes sense to put it in the DRAM controller for many reasons. One is that the DRAM silicon process is optimized for memory but terrible for logic. Also, a DRAM bank is several chips in parallel to get the data bus width, and they would all have to duplicate the logic. The disadvantage is that the controller and memory are made by different companies, so standards are required to agree on what access patterns are…

Agree. The extreme secrecy of DRAM manufacturers about the innards of their chips puts an additional obstacles in the way of memory controllers (MCs) implementing efficient Rowhammer defences. In particular, if the MC doesn't know which addresses are corresponding to neighbouring rows, how can an MC know with certainty that any concrete row is being attacked? (And, to the best of my knowledge, DRAM manufacturers don't give away this information.)

Re: Try to make sudo less vulnerable to Rowhammer attacks

#85
post #55

Earlier quoted context omitted.

Rowhammer is not architecture specific, since it's the DRAM rather than the CPU. The paper linked in the patch references other works showing every defence at rowhammer can be bypassed somehow (I've not followed them all) - e.g. it specifically says that ECC and the like can be bypassed.

Interesting. I did not expect that Rowhammer was architecture specific, only that the test I found was. I also did not expect that the various defenses, including ECC, could be bypassed.

It cannot be completely bypassed.

The attacker cannot control precisely which bits will be erroneous. When much more than 2 bits become erroneous, in a small fraction of the cases no error will be detected but a wrong value will be read at the next access.

However, in the majority of the cases an error will be detected, either non-correctable, or correctable in which case the corrected value will be wrong.

Despite the fact that wrong corrections are possible, in a system with ECC that is configured correctly it should be impossible for a RowHammer attack to escape detection, unlike for a system without ECC memory.

On a computer that is not defective, memory errors happen very seldom, typically one error after many months. Even only 2 correctable errors that happen in the same day represent an event that can be explained only by either a RowHammer attack or by a memory module that has become defective.

Therefore, a well configured computer with ECC memory should alert immediately its administrator when 2 on more errors happen in the same day, even if they had been correctable errors, because this requires immediate action, either stopping a RowHammer attack or replacing the defective memory module.

It would be pretty much impossible for any RowHammer attack to attain its target without triggering 2 or more ECC errors, which will reveal the attack attempt.

Only when there is no ECC the attack can proceed undetected for a time long enough to be successful.

Re: Try to make sudo less vulnerable to Rowhammer attacks

#86
post #69

Given that the most common use of sudo is to give yourself root to run a command, and malware looking to elevate root can just rig up ~/.bashrc, what use is this patch? What use cases does it apply to and how common are they?

>and malware looking to elevate root can just rig up ~/.bashrc, what use is this patch?

Apologies for self promotion, but I wrote a relevant blog post that discusses this[0]. Is there any way of mitigating this trivial attack?

I feel like the Unix/Linux security model is broken.

[0]: https://cedwards.xyz/sudo-is-broken/

Re: Try to make sudo less vulnerable to Rowhammer attacks

#87

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'm slightly bothered that the numbers don't have the same number of digits. The rows are not perfectly aligned!

Re: Try to make sudo less vulnerable to Rowhammer attacks

#88

Earlier quoted context omitted.

> I'm regularly seeing bit flips. How?

For example 7zip decompression CRC failures that resolve on a second try. It would be longer to explain how, but I tracked it multiple times to a single bit flip in the decompressed output.

I've also seen that, often enough that a hardware issue is extraordinarily unlikely. It's almost certainly just a boring old software bug.

Re: Try to make sudo less vulnerable to Rowhammer attacks

#89
Moron disclaimer: I may not be one entirely, but I frequently emulate one.

As a full-time Linux user, I haven't used sudo for years. Rather, I do 'su root'. However, I noticed several years ago (Debian) that upgrades would iterate twice, seemingly accommodating two accounts. Emulating a moron as I do, I never exerted the effort to learn why. I simply began, after 'su root', entering 'sudo su', which despite always having sudo disabled, seems to make me proper root.

I'll often use synaptic package manager when I want a cleaner, easier interface to explore packages. If I only 'su root' it won't open unless I append .... something similar to 'pkex' to the end, but if I do 'sudo su', I can run it using only 'synaptic'. Regardless, I refuse to use sudo otherwise, even when I'm emulating something sentient.

Be afraid. There are morons using Linux, and some are quite productive despite.

Re: Try to make sudo less vulnerable to Rowhammer attacks

#90

Earlier quoted context omitted.

> I'm regularly seeing bit flips. How?

For example 7zip decompression CRC failures that resolve on a second try. It would be longer to explain how, but I tracked it multiple times to a single bit flip in the decompressed output.

Thanks, that's pretty interesting. I'd actually be really interested if you would care to explain how, I think others would find it interesting also. I'm not even sure how I would approach trying to do that.
Post reply on HN