Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2B779200D57 for ; Mon, 11 Dec 2017 11:32:05 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 2A13F160C13; Mon, 11 Dec 2017 10:32:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 71FA2160C10 for ; Mon, 11 Dec 2017 11:32:04 +0100 (CET) Received: (qmail 29255 invoked by uid 500); 11 Dec 2017 10:32:03 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 29244 invoked by uid 99); 11 Dec 2017 10:32:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Dec 2017 10:32:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id F34131A058E for ; Mon, 11 Dec 2017 10:32:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id WdoNVBUv2xz7 for ; Mon, 11 Dec 2017 10:32:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 67B175F3B5 for ; Mon, 11 Dec 2017 10:32:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id EC7DEE0EF6 for ; Mon, 11 Dec 2017 10:32:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 50B97212FD for ; Mon, 11 Dec 2017 10:32:00 +0000 (UTC) Date: Mon, 11 Dec 2017 10:32:00 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (NET-647) FTP Command Injection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 11 Dec 2017 10:32:05 -0000 [ https://issues.apache.org/jira/browse/NET-647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sebb updated NET-647: --------------------- Issue Type: Improvement (was: Bug) > FTP Command Injection > ---------------------- > > Key: NET-647 > URL: https://issues.apache.org/jira/browse/NET-647 > Project: Commons Net > Issue Type: Improvement > Components: FTP > Affects Versions: 3.4, 3.5, 3.6 > Reporter: Toshitsugu Yoneyama > Priority: Critical > Original Estimate: 168h > Remaining Estimate: 168h > > Vulnerable program example(ftpClient.java) > --------------------------------------------------------- > private static final String username = "test"; // ftp user name > private static final String password = "test"; // ftp user password > FTPClient ftp = new FTPClient(); > FTPClientConfig config = new FTPClientConfig(); > ftp.configure(config); > boolean error = false; > try { > int reply; > String server = "localhost"; // terget ip address > ftp.connect(server); > System.out.println("Connected to " + server + "."); > System.out.println(ftp.getReplyString()); > ftp.login(username, password); > > String path = "test" // <= FTP command injection. > ftp.changeWorkingDirectory(path); > ...(snip)... > --------------------------------------------------------- > It does not check path in changeWorkingDirectory(). > So I can inject to FTP Command and I can do "FTP Bounce Attack", OS command injection from SITE command, and up/download malicious file. > For example: > String path = "test\r\nNOOP" // <= FTP command injection. > I suggest to this patch. > [before] > public boolean changeWorkingDirectory(String pathname) throws IOException { > return FTPReply.isPositiveCompletion(cwd(pathname)); > } > [aftter] > public boolean changeWorkingDirectory(String pathname) throws IOException { > String separator = "\r\n|[\n\r\u2028\u2029\u0085]"; > String paths[] = pathname.split(separator); > return FTPReply.isPositiveCompletion(cwd(paths[0])); > } > Best regards, -- This message was sent by Atlassian JIRA (v6.4.14#64029)