Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
proftpd-sftp-copy-file-write — ProFTPD 1.3.9d - High - Remote - Privilege leftover / File write - SFTP copy-file skips dest WRITE | Kitploit
Tools/GitHubGitHub/abraxas/proftpd-sftp-copy-file-write
Authentication & AuthorizationVulnerability AnalysisExploitationWeb Application ExploitationSecurity VirtualizationPenetration TestingPapers & ResearchLabs & Practice

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share
GitHubabraxas/proftpd-sftp-copy-file-write

proftpd-sftp-copy-file-write

ProFTPD 1.3.9d - High - Remote - Privilege leftover / File write - SFTP copy-file skips dest WRITE

View Repository
63 days agoNot yet reviewed

Abraxas Labs - proftpd-sftp-copy-file-write

abraxaslabs.tech  ·  github.com/abraxas  ·  @abraxas_null  ·  [email protected]  ·  proftpd-sftp-copy-file-write

proftpd-sftp-copy-file-write

Class: Privilege leftover / File write Reach: Remote

ProFTPD 1.3.9d (f59f248) - proftpd.org

contrib mod_sftp advertises copy-file once SFTPEngine is on (SFTP_FXP_EXT_DEFAULT). fxp_handle_ext_copy_file runs dest WRITE plus AllowOverwrite only if pr_fsio_stat(dst) succeeds. A dest that does not exist yet skips that check. pr_fs_copy_file2 then creates the file as the session UID, including under <Limit WRITE> DenyAll.

FTP STOR and SFTP OPEN-write still go through xfer_pre_stor, which always dir_checks WRITE before create. Public Issue 2095 is the inverse: SITE COPY skipped source READ. This leftover is dest WRITE on a new name.

IDno CVE yet
ClassPrivilege leftover / File write
ReachRemote (authenticated SFTP)
CWECWE-863
CVSSHigh: 7.1 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N
ProductProFTPD
Affected1.3.9d (f59f248e26bdfa514443e42bf72a145641df635d) contrib mod_sftp
Authauthenticated SFTP (SFTPEngine on)
LicenseGNU Affero GPL v3.0
Lab127.0.0.1 only

I pinned tag v1.3.9d and read fxp_handle_ext_copy_file. It dispatches PRE_CMD of a fake SITE COPY. mod_copy registers copy_copy as CMD, not PRE_CMD, so FTP's dest WRITE check never runs on this path. Source READ is always dir_check'd. Dest WRITE is not, unless the dest already exists. The lab is loopback SFTP on 127.0.0.1:18710.

What an attacker can do

MethodSinkPrivilege
SFTP EXTENDED copy-file readable src to a dest name that does not exist yet, under <Directory> with <Limit WRITE> DenyAllpr_fs_copy_file2Integrity (lab-proven): create that file as the session UID. Recon (lab-proven): SFTP READ of the dest returns the source bytes when dest READ is allowed.
Same dest already existsdir_check WRITE + AllowOverwriteClosed (lab-proven): copy-file overwrite returns permission denied.
SFTP OPEN / STOR / SCP upload of the same destxfer_pre_storClosed (lab-proven): OPEN write/create is SSH_FX_PERMISSION_DENIED (status 3).
Unauthenticated copy-fileSFTP authClosed. No shell. Unix DAC still applies.

Lab-proven vs inferred: dest create, dest READ of the witness, OPEN-write deny, and existing-dest overwrite deny are lab-proven. Unauth and Unix DAC remain inferred from the auth/chroot model.

Requires: contrib mod_sftp loaded, SFTPEngine on. Typical distro SFTP vhost. SFTPExtensions -copyFile turns the extension off.

Lab

cd lab
./run.sh

Loopback 127.0.0.1:18710 maps container 2222. Compose project proftpd-sftp-copy-file-write. Image tag proftpd-sftp-copy-file-write:1.3.9d. Witness PROFTPD-SFTP-COPY-FILE-WRITE-WITNESS. Last line:

SUCCESS PROFTPD-SFTP-COPY-FILE-WRITE dest-exists=yes open-write=denied copy-file=ok overwrite-denied=yes PROFTPD-SFTP-COPY-FILE-WRITE-WITNESS

The fix

dir_check dest WRITE even when the dest does not exist yet, before pr_fs_copy_file2. Or disable the extension: SFTPExtensions -copyFile.

References

  • github.com/proftpd/proftpd tag v1.3.9d (f59f248e26bdfa514443e42bf72a145641df635d)
  • fxp_handle_ext_copy_file in contrib/mod_sftp/fxp.c
  • SFTP_FXP_EXT_DEFAULT includes copy-file
  • Inverse (source READ skip on FTP SITE COPY, not this dest WRITE leftover): Issue 2095
  • CWE-863
Download Tool