VirtualBox

Opened 6 years ago

#17927 new defect

VBoxLinuxAdditions.run --target is dangerous if dir exists (possible data loss)

Reported by: Hagge Owned by:
Component: guest additions Version: VirtualBox 5.2.16
Keywords: Possible data loss Cc:
Guest type: Linux Host type: all

Description

Running VBoxLinuxAdditions.run usually creates a directory in /tmp. But running this script with option --target <dir> is very dangerous, if the directory <dir> already exists. This may result in a possible large data loss! The script more or less does:

  1. mkdir <dir>
  2. [extract several files to <dir>]
  3. chown -R <currentuser>:<currentuser> <dir>
  4. [build and install drivers]
  5. rm -rf <dir>

Now imagine you call this with the home directory as argument.

sudo ./VBoxLinuxAdditions.run --target ~

  1. This is a no-op, the home directory already exists.
  2. This will extract files all across the home directory. Bad idea!
  3. This will transfer ownership of *all* files in user's home directory (including the directory itself) to root. Very bad idea!!!
  4. [not relevant]
  5. This will remove the whole home directory. Totally unacceptable!!!

This is a grossly negligent, even fatal script design!!!!

If you want to do it this way, then there *must* be a check if the target directory <dir> already exists and the script must fail with an error if so.

Change History (0)

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use