I once had a script looking like the one below:


it had some strange laggy effects... Anyways, a friend "pranked" me by running the script overnight. My PC had a shutdown timer, but when I went to turn it on, it said that one of the CPU cores was failing to respond. Later I found out that it got fried.

My point is, can JS scripts like this really be used to damage your data nowadays?Or worse, damage your computer like it did to mine? If so, how common is it? I haven't noticed such scripts before until recently again. I'm more worried about my data then my hardware.

I know javascript is kinda limited, but I also know you can easily lag a tab or browser to death with it.

  • 3
    In general, software can't break hardware. To do that you'd need hardware that could potentially be overclocked, and gain access to overclock settings. A simple javascript function like the above can't do that. The simple function you're showing has zero chance of modifying data, since that would require an exploit, and neither of those commands looks in any way suspicious. Jun 26, 2019 at 20:07
  • @SteveSether Well thats just an example, but about 3 to 4 years ago (like I stated in the question) my friend pranked me with a JS script similar to that one, it basically duped all your tabs every second (Meaning it loads the same site which opens 2 tabs of the original site each second which means an ever expanding corruption that can crash your browser in seconds) And he accidentally let it go overnight Jun 27, 2019 at 7:08
  • Im sure nowadays people have ways to defend against such damage like what I sufficed... so yeah i guess JS CAN fry your cpu if you were to run something very dangerous and freely allow it access to your browser. Jun 27, 2019 at 7:09
  • 2
    If an infinite loop fries your CPU, your CPU was terrible to begin with and deserved to die.
    – Anders
    Jun 27, 2019 at 8:45
  • What do you mean by "damage your data"? That is very broad. Do you mean destroy files on your harddrive?
    – Anders
    Jun 27, 2019 at 8:48

2 Answers 2


Modern CPUs are designed to prevent damage due to overheating. They have overheating protection that operates independently of OS or BIOS. So, it is unlikely that executing JavaScript can damage your hardware.

As to potential impact on your data, modern browsers are designed to execute JavaScript in a limited environment that is meant to prevent abuse of JavaScript to harm or steal your data.

Even though that is the intent, from time to time vulnerabilities in browsers are found that might allow attackers to affect your browser in some way - for example, crash it by tricking you into visiting a Web site that they control.

Your best protections against it:

  • Keep your OS up to date
  • Keep your browser up to date
  • Use a browser extension that allows execution of JavaScript from trusted domains only (Firefox, Chrome)
  • yeah this was many years ago, but I did successfully fry one of my 4 CPUs. I only have 3 now. Well atleast on my old pc Jun 27, 2019 at 7:06

I would say no-ish. More on the ish later.

There is a layer of abstraction between the hardware and the user code it's running. The CPU itself, has throttling built into the CPU Microcode (possibly with additional support from the BIOS). This means that if the temperature is too high it will throttle the clock speed (slowing down your computer) irrespective of what operating system and programs are running on the machine.

That being said, it's still very possible a hardware (mis)configuration (or regular wear and tear) combined with certain programs can cause hardware to fail.

An example would be if the temperature monitoring on the CPU failed, or a heatsink is removed from a computer while running a very taxing program. The CPU wouldn't have enough of a chance to throttle and would most likely burn out. A non CPU example would be a program performing many write cycles to an SSD specifically to wear the cells out, especially because SSDs don't have a large number of write cycles.

More food for though (though this is malware at a nation-state/APT level): here's an example of where software was specifically designed to break hardware: stuxnet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.