Stuxnet Source Code
github.com
github.com
Surprisingly, I couldn't find a relevant XKCD for the post itself.
https://www.reuters.com/world/europe/putin-kept-macron-dista...
Shortly after, the Snowden leaks would happen, which influenced my decision otherwise
At the time they reckoned the authors had a functioning QA environment to ensure it actually worked (broke) the Siemens PLCs they were targeting.
I was working in industrial control and automation at the time, there were sweeping changes to what could and could not be done and by whom at every level.
Old drives of all manufacturers that sat unused were audited and had to be brought up-to-date before any sale or change of hands could occur, serials were noted etc etc.
Never felt like a manufacturer decision since it occurred in unison almost globally.
I think that project was way beyond the "really need" stage.
one was to spin it far faster than it should, then stop abruptly in an attempt to damage the centrifuge
one was to run it at the wrong RPM to spoil the product of the centrifuge
in either mode, it would replay 'good' data to make the centrifuge look functional to an administrator
the way I understood, a 'bonus goal' was to keep the Iranians unable to diagnose what was going wrong, both with their production process (producing bad stock) and the failures (promoting distrust in their engineers) - i can't find an article right now, but I remember reading they were churning through site engineers at the time - presumably firing them for the on-site failures of centrifuges or their inability to stop them
Maybe Israelis just went to the Elysee palace, and asked?
This was one of the first reports on the subject https://krebsonsecurity.com/2010/07/experts-warn-of-new-wind...
* EDIT removed two paragraphs with wrong information
On the documentary, they mention another virus which was supposed to be even worse than Stuxnet, the project name was Nitro Zeus.
Edit: Maybe it isn't what I wanted, but this article was good.
https://arstechnica.com/tech-policy/2011/07/how-digital-dete...
Goes double for Alex Gibney
[1]: https://docs.broadcom.com/doc/security-response-w32-stuxnet-...
(Can't link direct URL as work filter doesn't allow Quora!)
https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web...
https://www.quora.com/What-is-the-most-sophisticated-piece-o...
edit: someone beat me to it, I just didn't notice since it wasn't a direct link: https://news.ycombinator.com/item?id=38518286
Is there a way to write code (make binaries) such that it would be extremely difficult to recover the source code via decompilers or a disassembler?
When writing in a higher language such as e.g. C, you can use code obfuscators to make your C code extremely hard to read.
If you want to make decompiling even impossible, you could modify the machine code generated by the C compiler. Even slight moderations are already enough.
If you want to make it (virtually) impossible to even disassemble the machine code, you could encrypt your binary itself except for a small bootstrap that will unencrypt the remainder of the binary when it runs.
Obfuscating C code shouldn't have any bearing on the decompilability of the output.
> If you want to make it (virtually) impossible to even disassemble the machine code, you could encrypt your binary itself except for a small bootstrap that will unencrypt the remainder of the binary when it runs.
Unencrypting the binary at startup is somewhat easy to hook into. It's harder to decrypt each individual function when that function is called and then re-encrypt it after the function ends. Bonus points if you re-encrypt after each `CALL`.
This is stuff which was available back in 2003 -- that's when I first used techniques.
This is the entire point of obfuscation and it absolutely does affect how easy the code is to reverse engineer. If it didn’t, there wouldn’t be a market for obfuscators.
It was available already in the 1980's, so I learned at the time when I was manually disassembling computer games hoping to be able to crack them.
To protect it beyond a basic level - You can try but it's a cat-and-mouse game. A sufficiently skilled reverser will drop a debugger on your program, execute the code until it's past any decryption and then dump it from memory. So better schemes to obfuscate applications have been developed, like VMProtect, which makes a simple virtual machine with a custom instruction set and uses it to obfuscate your application. It's of course possible to break that as well, but it takes more time and requires more skill.
Since Windows (etc.) was free, and the university thought curriculum based largely on US uni-books, Windows is/was everywhere, even in sensitive environments. Window has the worst track record privacy and security (remember NSA_KEY?), and Iran got bitten by this very hard.
You make it sound easy, if that was the case they'd launch one attack every few months or so. This stuff is expensive, and making it 100x harder means 100x less attacks before the budget runs out.
Author mirrored web page: https://z0mbie.dreamhosters.com/
What was the motivation for the PR drive?
https://en.wikipedia.org/wiki/Stuxnet
It was publicised so much because it was the most advanced cyber weapon of its kind to ever been released.
Correction:
... it was the most advanced cyber weapon of its kind to ever been discovered
Remembering that the only reason we even know about stuxnet is because it was so aggressive that practically every PC on the planet caught it at one point. Also "stuxnet" is the name we gave it, it seems similar to another US Govt project that we know very little about codenamed "Olympic Games".
If it had not been so aggressive it would have gone completely unnoticed. Likely this is the case for a lot of state-sponsored malware. (especially coming out of FIVE-EYES).
But probably for the best, considering the havoc EternalBlue caused.
https://chat.openai.com/share/d5f0f002-6739-4b0f-ad50-d71207...
SetFastIoDispatch(): This function sets up the Fast I/O dispatch table for the driver. Fast I/O operations are a more efficient way to handle certain I/O operations in the Windows kernel.
HookingFileSystems(): Hooks into the file systems (NTFS, FastFAT, CDFS) to intercept file system operations. It modifies system behavior by redirecting calls to these file systems.
HookOne(): Hooks a single file system. It references a file system object by name and then attaches to it.
DriverNotificationRoutine(): A notification routine called when the driver's status changes, such as when a device is attached or detached.
AttachDevice(): Attaches the rootkit's device object to a target device in the system, allowing the rootkit to intercept calls to this device.
IsAllreadyAttached(): Checks if the rootkit is already attached to a target device.
CreateDevice(): Creates a device object for the rootkit, enabling it to interact with the system as a device driver.
IsMyDevice(): Checks if a given device object belongs to the rootkit.
SettingFlags(): Sets various flags for a device object to define its characteristics and behavior.
AttachToStack(): Attaches the rootkit's device object to the device stack of the target device.
OnFileSystemControl() and OnDirectoryControl(): These functions handle specific file system control and directory control operations, respectively. They are likely points where the rootkit intercepts and manipulates file system requests.
SetCompletionFileControl() and SetCompletionDirControl(): Set up completion routines for file and directory control operations, allowing the rootkit to execute additional code when these operations complete.
FileControlCompletionRoutine() and DirectoryCompletionRoutine(): Completion routines for file and directory control operations. They are invoked when file system and directory operations are completed, allowing the rootkit to intervene at this stage.
FreeMdl(), AllocateMdl(), CreateWorkRoutine(), WorkerRoutine(): These functions manage memory descriptors (MDLs) and work items, which are kernel objects used for deferred or asynchronous work.
GetOffsets(), FileCheck(), StrCheck(), TMPCheck(): These functions are involved in analyzing and potentially modifying file information during directory listings. They seem to be designed to hide or manipulate certain files or directories from being listed or accessed in a specific way.
CallDriver(), IRPDispatchRoutine(), SetZero(): Helper functions for handling IRP (I/O Request Packet) processing and manipulating device extension structures.
DriverEntry(): The entry point for the driver, setting up the rootkit when it is loaded into the system.It's plausible this took effort, so I think it's only fair if they license it - it seems also ethically fair, since their licence is permissive.
Realistically it unlikely that anyone would attempt to decompile and fully reverse engineer excel and attempt to package it as a product that they own. It just doesn’t make sense practically. But throwing something in Jira isn’t the same thing as actually putting in the work to reverse engineer it and make it effectively a perfect replication. You don’t unbake the cake, you can’t. You just figure out a process to end up with the same cake.
As for TOS goes, that’s its own other legal issue that has a mixed history erring on the side of TOS not actually being enforceable.
The people who did this work I think are fine to ask people to respect their license. They don’t have to worry about the US/Israel knocking at the door to tell them they can’t claim ownership anyways.
>but both of us spent hundreds, if not thousands, of hours between ASM code trying to figure out what was behind those binaries and we are providing the product of our hard work (i.e. readable C code) to you for free
also
> It is not a simple job and it is not a short job, both our licenses are extremely permissive
>I'd like to ask you is that our job get recognized...show us your support by giving us credit for what we did
Its also ironic that they expect others to follow their license when they are fine with ignoring the copyright of the original hackers.
Ultimately though, copyright as we have it today is extremely silly and all they are asking for is attribution which IMO should be the default.
Meanwhile when a dam breaks, immediately everyone and everything in its path will be obliterated. Vastly more people have died from dam failures than even the worst of the worst of nuclear power plant incidents, Chernobyl, where staggering incompetence met horrific design flaws and bugs. Something like that is impossible to happen today.
Do you have an example of nuclear energy plant being weaponized to the tune of hundreds of thousands of deaths?
What makes this worse than Colonial shutting down from a cyber attack?
Additionally, most countries don't have the resources to pull off something like Stuxnet, and the ones that do have much more to gain through corporate and government espionage.
“In January 1982, President Ronald Reagan approved a CIA plan to sabotage the economy of the Soviet Union through covert transfers of technology that contained hidden malfunctions, including software that later triggered a huge explosion in a Siberian natural gas pipeline, according to a memoir by a Reagan White House official.”
True or not, the risk of software Trojan horses in the big energy game was recognized pretty early. The lesson here is, potentially dangerous technology ought to be matched by a comprehensive security protocol.
>In January 1982, President Ronald Reagan approved a CIA plan to sabotage the economy of the Soviet Union through covert transfers of technology that contained hidden malfunctions..
Ooh now you've got me thinking about Chernobyl...
> I wonder how the majority of folk rationalise their viewpoint surrounding this situation without being seen as massively hypocritical?
It would be useful if you could point out what exactly are you feeling is hypocritical?
Infiltration (dropper/1. Main.c):
Stuxnet infiltrated systems by exploiting vulnerabilities in Windows. It often spread through infected USB drives. When a user plugged the USB into a computer, Stuxnet would use these vulnerabilities to install itself. In the dropper/1. Main.c file, the DllMain function is where this initial infiltration mechanism is initiated. This function sets up the malware in the system after it's been triggered, typically by the insertion of the infected USB.
Staying Hidden (dropper/2. STUBHandler.c):
Once installed, Stuxnet used rootkit techniques to hide its files and processes from antivirus software and the system’s administrators. In dropper/2. STUBHandler.c, the code manages the hiding of Stuxnet's activities, including concealing its files and processes, making the malware invisible to regular detection methods.
Verifying the target (dropper/3. OS.c):
Stuxnet was designed to act under specific conditions. It checked the infected system to determine if it matched its target - typically industrial control systems, particularly those using Siemens software and PLCs. In dropper/3. OS.c, functions like CheckSystemVersion ensure the system is compatible, and potentially, if it matches the target specifications, before proceeding further.
Delivering Payload through PLCs (dropper/6. MemorySections.c and beyond):
real damage was done by manipulating the PLCs controlling the centrifuges. Stuxnet altered the commands sent to these PLCs, causing the centrifuges to spin erratically and eventually fail. In dropper/6. MemorySections.c file likely includes functions for loading the malware's payload into memory, but the specific code targeting PLCs might be in other parts of the codebase that aren't as clearly identified.
... its way towards ...
> a very specific environment (iran nuclear plant)
Stuxnet was a full stack of plugins (which lends huge weight toward the early "big team" design and build theories of first observers).
There was a payload intended for very specific centrifuges ... and there was replication toward target logic ( Farsi language | locale seeking targets for copying ) IIRC.
The "work" of Stuxnet wasn't limited to screwing up the centrifuges, it also had seeking and limited comms.
"but the specific code targeting PLCs might be in other parts of the codebase that aren't as clearly identified" is something I've seen it generate when I asked details about a codebase as well, but it didn't have all the details.