guardicore / monkey

Infection Monkey - An open-source adversary emulation platform
https://www.guardicore.com/infectionmonkey/
GNU General Public License v3.0
6.62k stars 772 forks source link

Unclosed file handle by get_file_descriptor_for_new_secure_file #1252

Closed VakarisZ closed 3 years ago

VakarisZ commented 3 years ago

Describe the bug

monkey/monkey_island/cc/server_utils/encryptor.py:30 leaves a file handle open. Either get_file_descriptor_for_new_secure_file should not return a handle and the method should be renamed or the handle should be used in the proceeding statement.

Machine version (please complete the following information):

mssalvatore commented 3 years ago

According to http://timgolden.me.uk/pywin32-docs/PyHANDLE.html, the handle should be closed when the object is destroyed (goes out of scope?).

VakarisZ commented 3 years ago

Maybe that's why the FD was invalid...