T09 · Insecure Skill Coding Practices
- Location
src/list.js:33- Finding
FTP Credentials and File Data Are Transmitted Without TLS
- Content
View full analysis
Vulnerability Details
File Location:
src/list.js:30-34,src/upload.js:49-53,src/download.js:53-57,src/delete.js:33-39,src/rename.js:34-38
Vulnerability Type: Plaintext transmission of credentials and sensitive data
Risk Level: HighVulnerable Code
javascript // src/list.js:30-34 const client = new ftp.Client(); client.ftp.verbose = false; try { await client.access({ host, user, password, secure: false }); const list = await client.list(remotePath); }javascript // src/upload.js:49-53 const client = new ftp.Client(); client.ftp.verbose = false; try { await client.access({ host, user, password, secure: false }); await uploadFile(client, localPath, remotePath); }javascript // src/download.js:53-57 const client = new ftp.Client(); client.ftp.verbose = false; try { await client.access({ host, user, password, secure: false }); await downloadFile(client, remotePath, localPath); }javascript // src/delete.js:33-39 const client = new ftp.Client(); client.ftp.verbose = false; try { await client.access({ host, user, password, secure: false }); // Try to remove file first try { await client.remove(remotePath);javascript // src/rename.js:34-38 const client = new ftp.Client(); client.ftp.verbose = false; try { await client.access({ host, user, password, secure: false }); await client.rename(oldPath, newPath); }Technical Analysis
Every FTP connection explicitly sets
secure: false. This disables TLS and causes the FTP control channel and data channel to operate without transport encryption. The username and password are therefore exposed during authentication, while directory listings and uploaded or downloaded file contents may also be observed or modified in transit.FTP provides no protection against a network-positioned attacker. Disab ...[truncated 1180 chars]
- Remediation
View remediation
Remediation Suggestions
- Require FTPS by setting
secure: truefor every connection. - Enforce certificate validation and reject invalid, expired, or untrusted certificates.
- Fail closed rather than silently falling back to plaintext FTP.
- If legacy plaintext FTP must temporarily remain available, require an explicit high-risk configuration option and display a clear warning.
- Prefer a protocol with secure defaults, such as SFTP, where operationally possible.
- Rotate credentials previously used over plaintext FTP because they may already have been exposed.
- Add automated tests that verify no production connection configuration sets
securetofalse.
- Require FTPS by setting
