Hello there. I'm probably going to say a bunch of obvious things, sorry in advance :/
Current YARA-based malware detector can be circumvented easily:
import builtins will happily not be detected because all spaces have not been marked as repeatable)timeit does eval or that platform has a popen method... Did I mention that ().__class__.__bases__[0].__subclasses__()[88] is <class 'zipimport.zipimporter'>? I think it's endless...So... There is one remaining way to know what a script does: executing it in a sandboxed environment, but this raises questions too:
y) could do that (and the idea of including Pypy in PyPI is a nice level of meta ;) )So many questions... I hope this hasn't already been answered in another issue, I couldn't find anything when I searched.
Ping @xmunoz and @woodruffw to continue the discussion.
There was a fairly public effort, pysandbox, to create a "python sandbox" that was discontinued since it's really really [redacted] difficult to sandbox Python in-process.
More details are in this LWN article: https://lwn.net/Articles/574215/
Thanks a lot ! This goes in the direction we were heading I guess, leaving at least a few options that were suggested:
I have clearly reached my competency level, and continued a bit beyond, I鈥檇 love to learn more but I won鈥檛 be able to suggest a lot, and at this point, anything I might add will likely be a laughable proof of the dunning-kruger effect...
PEP 578 + the new audit API in Python 3.8 would probably work well for this purpose. We'd still need some amount of sandboxing, though.
Most helpful comment
PEP 578 + the new audit API in Python 3.8 would probably work well for this purpose. We'd still need some amount of sandboxing, though.