SSH-MITM proxy server ( is able to replace files in scp and sftp file transfers.This feature was improved in version 0.3.17. So you have to update your installation (and requirements).To replace a file with sftp you can start ssh-mitm with: ssh-mitm --sftp-handler replace_file --sftp-replace /bin/bashTo replace a file with scp: ssh-mitm --scp-interface replace_file --scp-replace /bin/bash