← Back to SOC feed Coverage →

Python has been used frequently by threat actors for compiling executable file with source code. I found python Stuxnet

yara LOW Yara-Rules
community
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Yara-Rules →
Retrieved: 2026-06-04T23:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may use Python to compile malicious executables from source code, leveraging its cross-platform capabilities for persistence and execution. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential threat actors exploiting Python for code compilation and execution in their environment.

YARA Rule

rule Stuxnet_MadeInPython
{
    meta:
        description = "Python has been used frequently by threat actors for compiling executable file with source code. I found python Stuxnet source code that can be executed with required dependencies. This rule is created in hopes to catch potental breakout of future Stuxnet."
        author = "Jin Kim"
        reference = "https://github.com/kenmueller/stuxnet"
        date = "2020-12-23"
    
    strings:
    // main function include this call stack as a second function call.
        $str1 = "old_infected_attributes = node_infected_attributes(graph)"
    //     def node_total_attributes(graph: nx.Graph) -> dict:
	// filter_for_node_type = lambda node_type: list(filter(lambda node: get_node_type(graph, node) == node_type, graph.node))
	// return {
	// 	NodeType.COMPUTER: len(filter_for_node_type(NodeType.COMPUTER)),
	// 	NodeType.DISCONNECTED_COMPUTER: len(filter_for_node_type(NodeType.DISCONNECTED_COMPUTER)),
	// 	NodeType.USB: len(filter_for_node_type(NodeType.USB)),
	// 	NodeType.PLC: len(filter_for_node_type(NodeType.PLC)),
	// 	'total': len(graph.node)
        $str2 = "NodeType.DISCONNECTED_COMPUTER"

    // found in create-graph.py
    // This line adds router nodes and computer nodes fro all the wireless networks.
    // for router_node in range(NUMBER_OF_LOCAL_WIRED_NETWORKS, NUMBER_OF_LOCAL_NETWORKS):
		// add_computer_nodes(graph, EdgeType.LOCAL_WIRELESS, router_node)
        $str3 = "add_computer_nodes(graph, EdgeType.LOCAL_WIRELESS, router_node)"
    
    condition:
        any of them
}

Deployment Notes

This YARA rule can be deployed in the following contexts:

This rule contains 3 string patterns in its detection logic.

References

False Positive Guidance

Original source: https://github.com/Yara-Rules/rules/blob/main/malware/APT_Stuxnet.yar