Do not use user input with FTP.
- Rule ID: php_lang_ftp_using_user_input
- Languages: php
- Source: ftp_using_user_input.yml
Description
Using raw unsanitized input with FTP methods is bad practice. It could put your application at risk for code injection attacks, or lead to path traversal, by which attackers can gain access to resources outside of the intended scope.
Remediations
❌ Do not form filenames or file paths for FTP from raw user input
$connection = ftp_ssl_connect("ftp.example.com", 21);
ftp_delete($connection, $_GET["name"]);
❌ Do not pass raw user input as arguments to FTP methods
$connection = ftp_ssl_connect($_GET["host"], 21);
Resources
Associated CWE
OWASP Top 10
Configuration
To skip this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --skip-rule=php_lang_ftp_using_user_input
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=php_lang_ftp_using_user_input
Ready to take the next step? Learn more about Bearer Cloud.