cliffe / SecGen

Create randomly insecure VMs
GNU General Public License v3.0
2.64k stars 318 forks source link

Problem starting a virtual machine #286

Closed andreashappe closed 1 year ago

andreashappe commented 1 year ago

I do have the same problem with build-in as well as with custom virtual machines. I am running Fedora Core 38 as hostmachine. Oracle Virtualbox itself is working (as I am able to use other virtual machines).

I am currently using the following configuration file:

<?xml version="1.0"?>

<scenario xmlns="http://www.github/cliffe/SecGen/scenario"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.github/cliffe/SecGen/scenario">

  <!-- An example access control misconfiguration, allows vi to run as root for any user -->
  <system>
    <system_name>sudo_root</system_name>
    <base distro="Debian" type="server"/>

    <vulnerability module_path="vulnerabilities/unix/access_control_misconfigurations/sudo_root_less"/>
    <vulnerability module_path="vulnerabilities/unix/access_control_misconfigurations/sudo_root_awk"/>

    <network type="private_network">
    <input into="IP_address"><value>192.168.56.101</value></input>
    </network>
    <utility module_path=".*parameterised_accounts">
    <input into="accounts">
        <generator type="account">
            <input into="username"><value>test</value></input>
            <input into="password"><value>test</value></input>
        </generator>
    </input>
    </utility>
  </system>

</scenario>

When I try to run the scenario, I get the following output:

➜  SecGen git:(master) ✗ ruby secgen.rb build-vms --project projects/SecGen20230621_170921 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SecGen - Creates virtualised security scenarios
            Licensed GPLv3 2014-22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please take a minute to tell us how you are using SecGen:
 https://tinyurl.com/SecGenFeedback

Relative path to project detected
Using /home/andy/SecGen/projects/SecGen20230621_170921
Building project: /home/andy/SecGen/projects/SecGen20230621_170921
Loading vagrant (up) in /home/andy/SecGen/projects/SecGen20230621_170921
Bringing machine 'sudo_root' up with 'virtualbox' provider...
==> sudo_root: Importing base box 'modules_bases_debian_wheezy_server'...
==> sudo_root: Matching MAC address for NAT networking...
==> sudo_root: Setting the name of the VM: SecGen20230621_170921_sudo_root_1687360219620_89178
==> sudo_root: Clearing any previously set network interfaces...
==> sudo_root: Preparing network interfaces based on configuration...
    sudo_root: Adapter 1: nat
    sudo_root: Adapter 2: hostonly
==> sudo_root: Forwarding ports...
    sudo_root: 22 (guest) => 2222 (host) (adapter 1)
==> sudo_root: Running 'pre-boot' VM customizations...
==> sudo_root: Booting VM...
==> sudo_root: Waiting for machine to boot. This may take a few minutes...
    sudo_root: SSH address: 127.0.0.1:2222
    sudo_root: SSH username: vagrant
    sudo_root: SSH auth method: private key
    sudo_root: 
    sudo_root: Vagrant insecure key detected. Vagrant will automatically replace
    sudo_root: this with a newly generated keypair for better security.
    sudo_root: 
    sudo_root: Inserting generated public key within guest...
    sudo_root: Removing insecure key from the guest if it's present...
    sudo_root: Key inserted! Disconnecting and reconnecting using new SSH key...
==> sudo_root: Machine booted and ready!
==> sudo_root: Checking for guest additions in VM...
    sudo_root: The guest additions on this VM do not match the installed version of
    sudo_root: VirtualBox! In most cases this is fine, but in rare cases it can
    sudo_root: prevent things such as shared folders from working properly. If you see
    sudo_root: shared folder errors, please make sure the guest additions within the
    sudo_root: virtual machine match the version of VirtualBox you have installed on
    sudo_root: your host and reload your VM.
    sudo_root: 
    sudo_root: Guest Additions Version: 5.0.16
    sudo_root: VirtualBox Version: 7.0
==> sudo_root: Setting hostname...
==> sudo_root: Configuring and enabling network interfaces...
==> sudo_root: Rsyncing folder: /home/andy/SecGen/projects/SecGen20230621_170921/environments/ => /tmp/vagrant-puppet/environments
vagrant@127.0.0.1's password: 

At this state, everything stops. I am also not sure what i should put into as vagrant password if this is needed. When I manually log into the system (using root:puppet) I can see that there is a vagrant home directory with three SSH keys in authorized_keys though.

Any suggestions how to best debug this?

cliffe commented 1 year ago

When it's working properly, you won't prompted for a password for rsync. Maybe try refreshing, updating your base boxes? Good luck!