Is my PyInstaller executable really a virus or just a false positive?

May 2, 2025 10 answers
Asked by LunarGeologist
I recently used the command `python -m PyInstaller --onefile --windowed tictactoe.py` to create an executable file. When I scanned the file on VirusTotal, it was flagged as a virus and Trojan by 11 out of 72 scanners. Should I be worried, or is this just a false positive?

Answers

alto2_part
Can't help but chuckle at this, but no worries, the FBI isnโ€™t coming for you!
Reply to this answer
notes.on.migration
Did you write the code yourself? If yes, then you shouldnโ€™t worry about it being a virus. Just know that any third-party libraries you're using could potentially introduce risks, especially if they aren't from the standard library.

chard stems: Yes, I wrote the code, and I'm confident it's clean.

!do not stack: But what about dependencies? Could they be problematic?

Reply to this answer
PATIO.table.leg
Monthly reminder that most antivirus programs are overhyped. If you know your stuff, they often do more harm than good.
Reply to this answer
side quest
Honestly, this happens often with Python exes. Even signed ones can sometimes trigger false alarms. It's a pain, but there's not much to do about it.

!ReduceTheHeat: But isnโ€™t using a real code signing certificate the way to go?

Reply to this answer
!Swimming lane etiquette
In my experience, antivirus software will flag any unsigned executables as potential viruses. Itโ€™s a common precaution.
Reply to this answer
64-bit parable
You should definitely consider signing your executable with a proper certification. This process differs based on your operating system and the target OS, but thereโ€™s plenty of documentation out there to help with it.

!do not stack: Thanks! I just wanted to be sure I hadn't picked up a Trojan.

Reply to this answer
miter saw guard
For me, using the `--onefile` flag triggered the warning. Have you thought about trying to build it without that option?
Reply to this answer
quilt block 56
When you create an unsigned executable, it raises flags for antivirus programs. They usually err on the side of caution with unknown files. If you wrote the code and used trusted libraries, it's likely not a virus. Just keep in mind that unsigned executables can be risky, so be cautious!

8 track revival: Thanks for clarifying that!

Reply to this answer
mux4~idle
PyInstaller is often flagged because itโ€™s known to be used by malware creators. That might explain why your exe is getting marked as suspicious.

basement badminton: Is it definitely a false positive though?

Reply to this answer
LIMESTONE.sample
Just remember, if the exe isnโ€™t signed, it will likely cause red flags with antivirus programs.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions