Source: backdoor-factory
Version: 3.4.2+dfsg-5
Severity: grave
Justification: renders package unusable
X-Debbugs-Cc: charlesmel...@outlook.com

Dear Maintainers, hi.

I was working to get a new debian release of backdoor-factory (bdf) before the
freeze and noted while testing it that it doesn't work with python3.

I tested the application trying to patch a binary in 4 scenarios:

1. ELF binary - ssh with -fPIE compiler flag set (it
shouldn't work as warned in the man page);
2. ELF binary - devtodo without -fPIE flag set (I've built it locally
and disabled hardening option in d/rules);
3. PE binary - premake4.exe;
4. PE binary - PSTools from microsoft (the one actually show in the README 
example).

In all test scenarios, bdf showed a message saying the binary wasn't
compatible although they were in 3 out of 4 scenarios.

Digging a little deeper in the source code, I've found the problem.
Even though bdf was patched to build with python3, those changes only
fixed syntactic problems (mostly print statements). The actual problem -
and source of the bug - is the change on how files are read in python3.

In python2, everything read from a file was considered a string. But in
python3 it is considered a bitearray if the file was opened as a binary
('rb' option for example). In the source code of bdf, everything is treated
as strings (comparisons, assignments, operations, etc), but now everything
read from the binary file is a bytearray so the program fails to
identify it as a susceptible binary.

Even though it would be easy to patch this to make bdf correctly
identify the file, every step after that would also need to be fixed
(Right now, it basicaly fails to identify the files as susceptible and
exits). That would require a major rewrite of the program, together with
testing and debugging.

Cheers,
Charles

-- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.0.0-5-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Reply via email to