If the RAM is only slightly faulty, so that the machine boots apparently normally, but sometimes crashes. Can the fault be leveraged somehow?
Possible? Yes. Probable? Hardly. It's way more a reliability (or availability) issue than a security one.
A faulty RAM can lead to data corruption, and that corruption almost always will lead to a Segmentation Fault and crash the process. If the process is the kernel, or a critical process (like
init on Linux systems), the entire computer crashes.
A less common effect is basically a hardware-induced RowHammer Attack. In this attack, a cell have its value changed intentionally. If you RAM banks are defective, there's an infinitesimal (but bigger than zero) chance that the byte changed will not crash the application and give it super powers. A
bash shell with UID 0 or a
cmd.exe instance with admin privileges are possible, but so improbable that you cannot count on it.
But leveraging a fault memory chip to actually attack the computer is almost out of question. An attacker that can execute code on the computer could employ countless privilege escalation attacks to gain more access, and an attacker with physical access can just take the disk, image it, and leave.