Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 51908 - vsftpd init script contains dangerous 'source' command
Summary: vsftpd init script contains dangerous 'source' command
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Rajiv Aaron Manglani (RETIRED)
URL:
Whiteboard:
Keywords:
: 53245 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-24 04:56 UTC by Benedict Verhegghe
Modified: 2004-09-30 20:20 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for the vsftpd init script (vsftpd-1.2.1) (vsftpd.diff,567 bytes, patch)
2004-05-24 04:59 UTC, Benedict Verhegghe
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benedict Verhegghe 2004-05-24 04:56:22 UTC
The vsftpd init script sources the configuration file /etc/vsftpd/vsftpd.conf.
This is dangerous because in the vsftpd configuration file strings including blanks can be used without quoting. 
Now when you source a file containing a line like
ftpd_banner=Welcome to my ftpserver.
bash will set 'ftpd_banner=Welcome' and try to execute the command 
'to my ftpserver'. Which luckily in my case just produced 
'to: command not found' 
Now imagine what will happen if one puts in the config file a line like
test=Strange reboot
or worse:
beware=never rm -rf /

It consider it a bad idea to source files to bash that were not written with that purpose. In the case of the vsftpd init script, it is merely intended to check the config file for the occurrence of a specific configuration line. 
This can easily be done by some other means, eg. grep. See my patch in attachment.

I have not made a systematic search (yet), but I would not be surprised to find such improper use of the source command in other places too.


Reproducible: Always
Steps to Reproduce:
1. Add a line 'ftpd_banner=Welcome to my FTP server' to /etc/vsftp/vsftpd.conf
2. /etc/init.d/vsftpd start
3.

Actual Results:  
runscript.sh: to: command not found

Expected Results:  
Not try to execute the 'to' command
Comment 1 Benedict Verhegghe 2004-05-24 04:59:54 UTC
Created attachment 31943 [details, diff]
Patch for the vsftpd init script (vsftpd-1.2.1)

This is the patch with my changes to the vsftpd init script, as mentioned in
the bug report.
Comment 2 Bryan Østergaard (RETIRED) gentoo-dev 2004-06-07 14:23:22 UTC
*** Bug 53245 has been marked as a duplicate of this bug. ***
Comment 3 Jeffrey Forman (RETIRED) gentoo-dev 2004-09-30 20:20:14 UTC
updated cvs, thanks Benedict.