Another Maya malware in the wild

Another scriptjob virus caught in the wild, and this one ** IS NOT CAUGHT ** by summer 2020 Autodesk plugin.


Here is a solution from Chinese community. Hope it can be added to Security Tools soon:

You can use auto translate to get the idea

1 Like

thanks for the heads up, I’ve also added this to our Malware scanner in ProPack just in case.

Just had this come in from an external developer at the studio I work for.

Looks like the same asset a week prior they sent us was clean, so its freshly hitting them.

We notified the external dev’s.

For treatment we have a simple python line scanning files, looking for keywords and flagging them to be cleaned, and then we are manually removing the userSetup, and it creates.

Any other suggestions?

Looks like I’ll be writing a script node scanner of our own that we can manually run on incoming files.

Another way to approach it is to start an offline maya with both the script node execution disabled and MAYA_SKIP_USER_SETUP = 1, then batch through all of your maya files looking for scriptNodes of any description, since changing the signatures of these is trivial. The author of the virus screwed up by leaving import os in plain text but Python gives you an infinity of ways to obfuscate a red flag command like that.

In general I’d suggest banning scriptnodes completely until ADSK get serious about security for them.

Also – you’ll need to look for unknown py and mel files in all of the maya script exec locations.


Oh, lots of questions Theodox!

Is script node execution disabled a standard option in “offline maya” mode?

And what is offline maya? that’s maya prompt -batch mode? Have a autodesk link for documented support?

where is that MAYA_SKIP_USER_SETUP = 1 going? That an env Var?

(going back 15 years of memory since I used maya prompt, and google is just returning piracy questions for using maya offline. I recall one of the modes to be stripped down, and one had to manually run what scripts were needed)

  1. MAYA_SKIP_USER_SETUP=1 will disable
  2. To disable script node execution, you want cmds.optionVar(iv= ("fileExecuteSN", 0))
  3. I should have said “mayapy” – i was thinking you’d make a tool which fired up mayapy (in a process with MAYA_SKIP_USER_SETUP=1), used the optionVar to disable script node execution, and then looped through all the files you care about cataloging and/or deleting their script node contents.

Here’s the shell of a script you could use, though it needs to be beefed up – it just audits for fiiles with any script nodes other than the two standard ones (sceneConfigurationScriptNode and uiConfigurationScriptNode). A clever attacker could hijack those, so this is NOT production quality security – but it could be turned into such with some attention.

# usage :
# mayapy.exe   path/to/directory/to/scan
# recursively scanes all maya files in path/to/directory/to/scan 

import sys
import logging
logger = logging.getLogger("mayascan")

import os
os.environ['MAYA_SKIP_USER_SETUP'] = "1""usersetup disabled")

import maya.standalone
maya.standalone.initialize()"maya initialized")

import maya.cmds as cmds
cmds.optionVar(iv= ("fileExecuteSN", 0))"scriptnodes disabled")

file_list = []
counter = 0

for root, _, files in os.walk(sys.argv[-1]):
    for mayafile in files:
        lower = mayafile.lower()
        if lower.endswith(".ma") or lower.endswith(".mb"):
            counter += 1
            abspath = os.path.join(root, mayafile)
  "scanning {}".format(abspath))
            cmds.file(abspath, open=True)
            scriptnodes ='script')
            # almost all Maya files will contain two nodes named
            # 'sceneConfigurationScriptNode' and 'uiConfigurationScriptNode'
            # a proper job wouldd make sure that they contained only trivial MEL 
            # but youd have to really inspect the contents to make sure
            # a smart attacker hadn't hidden inside those nodes.  For demo purposes
            # I'm just ignoring them but that is a clear vulnerability

            if len(scriptnodes) > 2:
                # here's where you'd want to nuke and resave the file if you were really cleaning house,
                # or you could loop through them applying your own safety test
                logger.warning("file {} contains {} scriptnodes".format(abspath, len(scriptnodes) - 2 ))
                file_list.append(abspath)"scanned {} files".format(counter))
if file_list:
    logger.warning ("=" * 72)
    logger.warning ("filenodes found in:")
    for f in file_list:


Thanks so much!

Maybe what I’m thinking is overkill but for long term, I was thinking about registering the script nodes with a custom attr stored in an asset db*, or external file, and then scanning for un-registered nodes and flagging files / automatically cleaning out the nodes. Would have to find a way to keep our “tag” of the asset hidden and not go out in any files to external developers.

At least, I have a way to let the producers scan the incoming files for suspicious nodes now.

We do have python distributed environments, and we only work in ascii so I wasn’t limited to mayapy, and just did a fast ascii script search.

For others, simple ascii scanner for maya script nodes, puts all nodes in a dictionary to do with as you please: (os walk file method not included)

# go get script node code blocks
for ma in maya_ascii_files:
    script_nodes = dict()
    script_node_block = None
    f = open(ma, 'r')
    for line in f:
        if line.startswith('createNode script'):
            script_node_block = line.rsplit('"')[-2]
            script_nodes[script_node_block] = [line]
        elif script_node_block is not None and line.startswith('\t'):
            script_node_block = None

As a note in another train of thought, one machine got a full file, many didn’t, and only got the userSetup. I’m not sure where/when it gets created yet. I didn’t look closely at the opening script node code posted in the original post, but I wonder about not keeping that code public. ¯\(ツ)

I think what I’d do for internal security is to have a “secret” value like you would for a web app:

1 generate a checksum value for the script contents of the node .
2. combine it with the secret value to generate a final checksum
3. Store the result in an attribute
4. When scanning, first check for the presence of your attribute – if it’s not present the node is not one of your in-house ones
5. finally, check the crc against a crc of the current script to guarantee it has not been tampered with.

Here’s an example module that uses a sha512 hash:

import maya.cmds as cmds
import hashlib

SECRET = '1234567890987654321'  

def generate_hash(node, secret):
    Generates a sha512 hash for <node> as a string, keyed with <secret>
    hasher = hashlib.sha512()
    hasher.update(str(cmds.getAttr(node +  ".scriptType")).encode('utf-8'))
    hasher.update(str(cmds.getAttr(node + ".sourceType")).encode('utf-8'))
    before = cmds.getAttr(node +  ".before") or 'empty before'
    after = cmds.getAttr(node + ".after") or 'empty_after'
    return hasher.hexdigest()
def update_hash(node, secret):
    Updates scriptNode <node> with a correct hash attribute using <secret>
    if not + ".hash"):
        cmds.addAttr(node, ln = "hash", dt='string', hidden=True)
    new_hash = generate_hash(node, secret)
    cmds.setAttr(node + ".hash", new_hash, type='string')

def validate_hash(node, secret):
    Ensures that scriptNode <node> has a valid hash for the supplied secret
    if not + ".hash"):
         return False
    return cmds.getAttr(node + ".hash") == generate_hash(node, secret)

def scan_script_nodes(secret):
    Yields a tuple of <node>, <valid> for all scriptNodes in the scene,
    where "valid" is true if the node has a valid hash attribute.

    This is code you'd want to include in a scanner or in a file-open callback.
    for item in'script', recursive=True):
        yield item, validate_hash(item, secret)
def update_all_script_nodes(secret):
    Updates all the script nodes in the scene so their hash values represent
    their current contents and the supplied secret.

    You'd probably want to run this on file save, or ask the user on save.
    for item in'script', recursive=True):
        update_hash(item, secret)

This is still not bank level security but it’s better than nothing. Whatever you do, let the secret value show up in code an attacker could see – you probably want to install it an an env var or a text file you load at startup. It’s essentially the “password” for scripts you want to allows so it’s important not to allow it to float free. An internal-only file share or an environment variable on internal machines is a good choice since they are harder to leak; so would an internal webserver which only gave out the value to approved IP addresses.

1 Like

Is the same risk not posed by any program that can execute arbitrary code contained within it’s scene files (i.e. any DCC app I can think of has some mechanism for this). Install a security check on maya scriptjobs, sure, but theres a bigger probem which to me feels is most effectively solved by quarantining 3rd-party files that may contain malicious code. However you do it, this seems like a wakeup call make sure you’re thoroughly checking your maya/houdini/3ds-max/etc files before loading them in an app which has full network access.

You’re correct - any program that executes code on load is vulnerable , this goes all the way back to activeX in MS Word docs. I’d always recommend quarantining and then scanning the incoming files.


As we’ve been looking at security issues in the Maya Security Project it’s become clear that scriptNodes are NOT the only easy attack vector — while the code above is useful it is also nothing like a guarantee. Please be careful!