Bug 2544481 - CVE-2026-78254 ant: Apache Ant: Arbitrary file write via path traversal in ftp and scp tasks [fedora-all]
Summary: CVE-2026-78254 ant: Apache Ant: Arbitrary file write via path traversal in ft...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: ant
Version: rawhide
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Marián Konček
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: {"flaws": ["18cfd50e-f5bb-406a-85dc-e...
Depends On:
Blocks: CVE-2026-78254
TreeView+ depends on / blocked
 
Reported: 2026-10-01 09:27 UTC by Tomas Hoger
Modified: 2026-10-21 18:20 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)
backported patch (18.53 KB, patch)
2026-10-21 18:20 UTC, Artem Dinaburg
no flags Details | Diff

Description Tomas Hoger 2026-10-01 09:27:58 UTC
Disclaimer: Community trackers are created by Red Hat Product Security team on a best effort basis. Package maintainers are required to ascertain if the flaw indeed affects their package, before starting the update process.

The ftp and scp tasks of Apache Ant can download files from a remote server. A malicious server can provide relative paths that allow it to write outside of the dedicated target directory for the download, making it possible to overwrite files of the attacker's choice using the permissions of the user running Ant in versions prior to Ant 1.10.18. 




In order to exploit this vulnerability, the server would either have to be malicious or be subject to a machine-in-the-middle attack. Additionally in the case of scp or the ftp task using ftps the server must pass the server identity checks performed by the tasks.




For ftp tasks not using ftps a malicious server could act as a machine-in-the-middle to provide malicious files.




Starting with Ant 1.10.18 both tasks will prevent writing outside of the destination directory by default. An option is available to disable this behavior in the unlikely case that the  old behavior is required by existing build files.




Mitigations:




Users of scp and ftp (when using ftps) in any version of Ant should not bypass server identity checks. Users of ftp not using ftps should switch to ftps where possible.




All users are recommended to upgrade to Apache Ant 1.10.18, which fixes this issue.

Comment 1 Artem Dinaburg 2026-10-21 18:19:46 UTC
Hello,

Thank you for maintaining Ant in Fedora. I've prepared a backport of the upstream fix for
CVE-2026-78254 and would appreciate a review for Fedora 43 and 44.

The <ftp> and <scp> tasks build local file names from names sent by the remote server without
checking that the result stays inside the download directory. A malicious server, or a
machine-in-the-middle on plain FTP, can send names containing ../ and overwrite any file the
user running Ant can write. Fedora 43, 44 and rawhide all ship Ant 1.10.15, which is
affected; upstream fixed it in Ant 1.10.18.

The attached patch backports upstream commits 07ee9c418e3b (ftp), 9252566cab81 and its
follow-up 3807d672ea18 (scp/sftp), and 7809cdd503b9 (ftp mirror). Downloads whose target
resolves outside the destination are now skipped with a warning, and, as upstream, a new
allowFilesToEscapeDest attribute restores the old behavior if a build really needs it. The only
adaptation is in the log messages: they use File.getCanonicalPath() because
FileUtils.getResolvedPath() is not available in 1.10.15.

AI assistance was used to prepare this patch and its validation. The resulting
changes and validation results were reviewed by a human.

Thank you for taking a look. I'd be glad to adjust the backport if needed.

Comment 2 Artem Dinaburg 2026-10-21 18:20:25 UTC
Created attachment 2161891 [details]
backported patch


Note You need to log in before you can comment on or make changes to this bug.