47
Cloud security Tom Ristenpart CS 6431

Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Cloudsecurity

TomRistenpartCS6431

Page 2: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Software-as-a-serviceInfrastructure-as-a-service

Cloudproviders

CloudcomputingNIST: Cloud computing is a model for enabling convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction.

Platform-as-a-service

Page 3: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

“IfcomputersofthekindIhaveadvocatedbecomethecomputersofthefuture,thencomputingmaysomedaybeorganizedasapublicutilityjustasthetelephonesystemisapublicutility...Thecomputerutilitycouldbecomethebasisofanewandimportantindustry.”— JohnMcCarthy,speakingattheMITCentennialin1961

Page 4: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

PublicIaaS clouds(Infrastructure-as-a-Service)

UserA

UserB

virtualmachines(VMs)

virtualmachines(VMs)

VirtualMachineManagerVirtualizationofresources(compute,networking)as

managedbyprovider

Multitenancy (userssharephysicalresources)

IaaSprovider

User’spayforresourcesused

Page 5: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

PublicPaaS clouds(Platform-as-a-Service)

PaaS user1

PaaS user2

Applicationprograms

Applicationprograms

IaaSprovider

PaaS userssubmitapplications:• Docker containers(processgroups)• PHP/Python/Java/Rubyapps• MapReduce /Sparkprograms

PaaS providermanagesruntime

OSandmanagedruntime

Page 6: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Alayeredecosystem

OS

VMM

Physical

Platform

Service

IaaS

PaaS

SaaS

AmazonEC2

Heroku

SalesForce “Serverless” FaaS AmazonLambdas

Page 7: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

HTTPrequest

DBofuserdata

Theongoingmigrationtothecloud

2012:4%ofAlexa Top1MilliondomainsmakeuseofEC2/Azure

180 K182 K184 K186 K188 K190 K

1 6 11 16 21 26 31 36 41 46 51

#Clu

ster

Cluster

710 K720 K730 K740 K750 K760 K770 K780 K

#IP

Available IP

1000 K1050 K1100 K1150 K1200 K

#IP

Responsive IP

AmazonEC2:4,702,208targetIPaddresses

4.9%growthover3months

[He,Wang,Fisher,Gembler,Akella,R.– IMC13][Wang,Nappa,Caballero,R.,Akella – IMC14]

Mean#IP/Round

33,1455,5972,0291,167617

Page 8: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

http://thenextweb.com/insider/2015/09/20/amazon-web-services-goes-down-taking-netflix-reddit-pocket-and-more-with-it/

Page 9: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Trustmodelsinpubliccloudcomputing

UserB

Securitythreatsinpubliccloudcomputing?

UserA

AdversarialproviderspyingonrunningVMs/data

Cross-userattacksVMimageattacksSide-channelsattacks

Externalattacksagainstinfrastructure

Page 10: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand
Page 11: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

VirtualMachineManagement

• Snapshots– Volumesnapshot/checkpoint• persistentstorageofVM• mustbootfromstoragewhenresumingsnapshot

– Fullsnapshot• persistentstorageandephemeralstorage(memory,registerstates,caches,etc.)• start/resumeinbetween(essentially)arbitraryinstructions

• VMimageisafilethatstoresasnapshot

Page 12: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

AmazonMachineImages(AMIs)• Userssetupvolumesnapshots/checkpointsthatcanthenberunontheElasticComputeCloud(EC2)

• CanbemarkedaspublicandanyonecanuseyourAMI

Storageservice

Page 13: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

��

�����

�������� ����

���������

�������������

�����

�����

�����������

���

���� ����������

���

��

������������

� ��!���"��

��� �����

#��������������$�"������

Figure 1: System Architecture

and bitnami for Linux). Despite these attempts, there arecases in which the robot may fail to retrieve the correct logininformation. This is the case, for example, for AMIs whosecredentials are distributed only to the image provider’s cus-tomers by companies that make business by renting AMIs.Hence, these type of images are outside the scope of ourevaluation.

After an AMI has been successfully instantiated by therobot, it is tested by two di�erent scanners. The RemoteScanner collects the list of open ports1 using the NMap tool [23],and downloads the index page of the installed web applica-tions. In Section 5, we explain how an attacker can usethis information as a fingerprint to identify running images.The Local Scanner component is responsible for uploadingand running a set of tests. The test suite to be executedis packaged together in a self-extracting archive, uploadedto the AMI, and run on the machine with administrativeprivileges. In addition, the Local Scanner also analyzes thesystem for known vulnerabilities using the Nessus tool [30].For AMIs running Microsoft Windows, the scripting of au-tomated tasks is complicated by the limited remote adminis-tration functionalities o�ered by the Windows environment.In this case, we mounted the remote disk and transfered thedata using the SMB/Netbios subsystem. We then used thepsexec tool [27] to execute remote commands and invokethe tests.

The test suite uploaded by the Local Scanner includes 24tests grouped in 4 categories: general, network, privacy, andsecurity (for the complete list see Appendix A).

The general category contains tests that collect generalinformation about the system (e.g. the Linux distributionname, or the Windows version), the list of running processes,the file-system status (e.g., the mounted partitions), the listof installed packages, and the list of loaded kernel mod-ules. In addition to these basic tests, the general categoryalso contains scripts that save a copy of interesting data,such as emails (e.g., /var/mail), log files (e.g., /var/logand %USER\Local Settings), and installed web applications(e.g., /var/www and HKEY_LOCAL_MACHINE\SOFTWARE).1 Since Amazon does not allow external portscans of EC2machines, we first established a virtual private network con-nection to the AMI through SSH, and then scanned the ma-chine through this tunnel.

The privacy test cases focus on finding any sensitive in-formation that may have been forgotten by the user thatpublished the AMI. This includes, for example, unprotectedprivate keys, application history files, shell history logs, andthe content of the directory saved by the general test cases.Another important task of this test suite is to scan thefilesystem to retrieve the contents of undeleted files.

The network test suite focuses on network-related infor-mation, such as shared directories and the list of open sock-ets. These lists, together with the processes bound to thesockets, can be used to verify if the image is establishingsuspicious connections.

Finally, the security test suite consists of a number ofwell-known audit tools for Windows and Linux. Some ofthese tools look for the evidence of known rootkits, Tro-jans and backdoors (e.g. Chkrootkit, RootkitHunter andRootkitRevealer), while others specifically check for pro-cesses and sockets that have been hidden from the user(PsTools/PsList and unhide). In this phase, we also runthe ClamAV antivirus software (see Section 4.2) to scan forthe presence of known malware samples.

These security tests also contain checks for credentialsthat have been left or forgotten on the system (e.g., databasepasswords, login passwords, and SSH public keys). As al-ready mentioned in an Amazon report published in June2011 [15], these credentials could potentially be used as back-doors to allows attackers to log into running AMIs.

4 Results of the AMIs Analysis

Over a period of five months, between November 2010 toMay 2011, we used our automated system to instantiate andanalyze all Amazon images available in the Europe, Asia,US East, and US West data centers. In total, the cata-log of these data centers contained 8,448 Linux AMIs and1,202 Windows AMIs. Note that we were successfully ableto analyze in depth a total of 5,303 AMIs. In the remainingcases, a number of technical problems prevented our tool tosuccessfully complete the analysis. For example, sometimesan AMI did not start because the corresponding manifestfile was missing, or corrupted. In some cases, the runningimage was not responding to SSH, or Remote Desktop con-nections. In other cases, the Amazon API failed to launchthe machine, or our robot was not able to retrieve valid logincredentials. These problems were particularly common forWindows machines where, in 45% of the images, the Ama-zon service was not able to provide us with a valid usernameand password to login into the machine. Nevertheless, webelieve that a successful analysis of over 5,000 di�erent im-ages represents a sample large enough to be representativeof the security and privacy status of publicly available AMIs.

Table 1 shows a number of general statistics we collectedfrom the AMIs we analyzed. Our audit process took on av-erage 77 minutes for Windows machines, and 21 minutes forthe Linux images. This large di�erence is due to two mainreasons: first, Windows machines in the Amazon cloud takea much longer time to start, and, second, our antivirus testwas configured to analyze the entire Windows file-system,while only focused the analysis on directories containing ex-ecutables for the Linux machines.

In the rest of this section, we present and discuss the re-sults of the individual test suites.

Balduzzi etal.“ASecurityAnalysisofAmazon’sElasticComputeCloudService– LongVersion–”,2011

SeealsoBugiel etal.,“AmazonIA:WhenElasticitySnapsBack”,2011

5,303AMIsanalyzed(LinuxandWindows)

Page 14: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Average #/AMI Windows LinuxAudit duration 77 min 21 minInstalled packages – 416Running Processes 32 54Shares 3.9 0Established sockets 2.75 2.52Listening sockets 22 6Users 3.8 24.8Used disk space 1.07 GB 2.67 GB

Table 1: General Statistics

4.1 Software Vulnerabilities

The goal of this first phase of testing is to confirm the factthat the software running on each AMIs is often out of dateand, therefore, must be immediately updated by the userafter the image is instantiated.

For this purpose, we decided to run Nessus [30], an au-tomated vulnerability scanner, on each AMI under test. Inorder to improve the accuracy of the results, our testingsystem provided Nessus with the image login credentials, sothat the tool was able to perform a more precise local scan.In addition, to further reduce the false positives, the vulner-ability scanner was automatically configured to run only thetests corresponding to the actual software installed on themachine. Nessus classifies each vulnerability with a sever-ity level ranging from 0 to 3. Since we were not interestedin analyzing each single vulnerability, but just in assessingthe general security level of the software that was installed,we only considered vulnerabilities with the highest severity(e.g., critical vulnerabilities such as remote code execution).

We also looked at the most common vulnerabilities thata�ect Windows and Linux AMIs. These results are detailedin Appendix B.

From our analysis, 98% of Windows AMIs and 58% ofLinux AMIs contain software with critical vulnerabilities.This observation was not typically restricted to a single ap-plication but often involved multiple services: an average of46 for Windows and 11 for Linux images (the overall dis-tribution is reported in Figure 2). On a broader scale, weobserved that a large number of images come with softwarethat is more than two years old. Our findings empiricallydemonstrate that renting and using an AMI without anyadequate security assessment poses a real security risk forusers. To further prove this point, in Section 4.2, we describehow one of the machines we were testing was probably com-promised by an Internet malware in the short time that wewere running our experiments.

4.2 Security Risks

Malware

As part of our tests, we used ClamAV [8], an open source an-tivirus engine, to analyze the filesystem on the target AMI.ClamAV contains about 850,000 signatures to identify dif-ferent types of known malware instances such as viruses,worms, spyware, and trojans. Since most of the existingmalware targets the Windows operating systems, we ana-lyzed the complete file-system tree of Windows AMIs, whilewe limited the coverage for Linux AMIs to common binarydirectories (e.g. /usr/bin, /bin, and /sbin). As a conse-quence, the scan time took on average of 40 minutes for a

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

���

��

���

��

��

��

��

��

������ ����������

���

���

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

���

��

���

��

��

��

��

��

������ ����������

���

���

��

� � �� �� �� �� �� � � �� �� �� �� �� � �� �� ���

�� �� �� � � � � �� � � �� �� � � ���

��

���

���

���

���

���

���

������ ����������

���

���

��

Figure 2: Distribution AMIs / Vulnerabilites (Win-dows and Linux)

Windows installation, and less then a minute for a Linuxone.In our malware analysis, we discovered two infected AMIs,

both Windows-based. The first machine was infected witha Trojan-Spy malware (variant 50112). This trojan has awide range of capabilities, including performing key logging,monitoring processes on the computer, and stealing datafrom files saved on the machine. By manually analyzingthis machine, we found that it was hosting di�erent types ofsuspicious content such as Trojan.Firepass, a tool to de-crypt and recover the passwords stored by Firefox. The sec-ond infected machine contained variant 173287 of the Tro-jan.Agent malware. This malware allows a malicious userto spy on the browsing habits of users, modify Internet Ex-plorer settings, and download other malicious content.While we were able to manually confirm the first case,

we were unable to further analyze the second infected ma-chine. In fact, after we rented it again for a manual analysisa few hours after the automated test, the infected files didnot existed anymore. Hence, we believe that the AMI wasmost probably compromised by an automatically propagat-ing malware during the time that we were executing ourtests. In fact, the software vulnerability analysis showedthat di�erent services running on the machine su�ered fromknown, remotely exploitable, vulnerabilities.

Unsolicited connections

Unsolicited outgoing connections from an invoked instanceto an external address may be an indication for a significantsecurity problem. For example, such connections could be

LinuxAMIs

Also:MalwarefoundonacoupleAMIsBalduzzi etal.“ASecurityAnalysisofAmazon’sElasticComputeCloudService– LongVersion–”,2011

Page 15: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Balduzzi etal.analysis• Backdoors– AMIsincludeSSHpublickeyswithinauthorized_keys

– Password-basedbackdoors

the evidence of some kind of backdoor, or the sign for a mal-ware infection. Outgoing connections that are more stealthymay also be used to gather information about the AMI’s us-age, and collect IP target addresses that can then be usedto attack the instance through another built-in backdoor.

In our experiments, we observed several images that openedconnections to various web applications within and outsideof Amazon EC2. These connections were apparently check-ing for the availability of new versions of the installed soft-ware. Unfortunately, it is almost impossible to distinguishbetween a legitimate connection (e.g., a software update)and a connection that is used for malicious purposes.

Nevertheless, we noticed a number of suspicious connec-tions on several Linux images: The Linux operating systemcomes with a service called syslog [3] for recording variousevents generated by the system (e.g., the login and logoutof users, the connection of hardware devices, or incomingrequests toward the web server).

Standard installations record these kinds of events in filesusually stored under the /var/log directory and only userswith administrative privileges are allowed to access the logsgenerated by the syslog service. In our tests, we discoveredtwo AMIs in which the syslog daemon was configured tosend the log messages to a remote host, out of the control ofthe user instantiating the image. It is clear that this setupconstitutes a privacy breach, since confidential information,normally stored locally under a protected directory, weresent out to a third party machine.

Backdoors and Leftover Credentials

The primary mechanism to connect to a Linux machine re-motely is through the ssh service. When a user rents anAMI, she is required to provide the public part of the herssh key that it is then stored by Amazon in the autho-rized_keys in the home directory. The first problem withthis process is that a user who is malicious and does notremove her public key from the image before making it pub-lic could login into any running instance of the AMI. Theexistence of these kinds of potential backdoors is known byAmazon since the beginning of April 2011 [25].

A second problem is related to the fact that the ssh servermay also permit password-based authentication, thus pro-viding a similar backdoor functionality if the AMI providerdoes not remove her passwords from the machine. In addi-tion, while leftover ssh keys only allow people with the corre-sponding private key (normally the AMI image creator), toobtain access to the instance, passwords provide a larger at-tack vector: Anybody can extract the password hashes froman AMI, and try to crack them using a password-crackingtool (e.g., John the Ripper [13]).

In other words, ssh keys were probably left on the imagesby mistake, and without a malicious intent. The same ap-plies to password, with the di�erence that passwords canalso be exploited by third parties, transforming a mistake ina serious security problem.

During our tests, we gathered these leftover credentials,and performed an analysis to verify if a remote login wouldbe possible by checking the account information in /etc/passwdand /etc/shadow, as well as the remote access configurationof OpenSSH.

The results, summarized in Table 2, show that the prob-lem of leftover credentials is significant: 21.8% of the scannedAMIs contain leftover credentials that would allow a third-

East West EU Asia TotalAMIs (%) 34.8 8.4 9.8 6.3 21.8With Passwd 67 10 22 2 101With SSH keys 794 53 86 32 965With Both 71 6 9 4 90Superuser Priv. 783 57 105 26 971User Priv. 149 12 12 12 185

Table 2: Left credentials per AMI

party to remotely login into the machine. The table alsoreports the type of credentials, and lists how many of thesewould grant superuser privileges (either via root, sudo or suwith a password).

4.3 Privacy Risks

The sharing of AMIs not only bears risks for the customerswho rent them, but also for the user who creates and dis-tributes the image. In fact, if the image contains sensitive in-formation, this would be available to anybody who is rentingthe AMI. For example, an attacker can gather SSH privatekeys to break into other machines, or use forgotten AmazonWeb Services (AWS) keys to start instances at the imageprovider’s cost. In addition, other data sources such as thebrowser and shell histories, or the database of last login at-tempts can be used to identify and de-anonymize the AMI’screator.

Private keys

We developed a number of tests to search the AMIs’ file-system for typical filenames used to store keys (e.g., id_dsaand id_rsa for SSH keys, and pk-[0-9A-Z]*.pem and cert-[0-9A-Z]*.pem for AWS API keys). Our system was ableto identify 67 Amazon API keys, and 56 private SSH keysthat were forgotten. The API keys are not password pro-tected and, therefore, can immediately be used to start im-ages on the cloud at the expense of the key’s owner. Eventhough it is good security practice to protect SSH keys witha passphrase, 54 out of 56 keys were not protected. Thus,these keys are easily reusable by anybody who has access tothem. Although some of the keys may have been generatedspecifically to install and configure the AMI, it would notbe a surprising discovery if some users reused their own per-sonal key, or use the key on the AMI to access other hosts,or Amazon images.By consulting the last login attempts (i.e., by lastlog

or last commands), an attacker can easily retrieve IP ad-dresses that likely belong to other machines owned by thesame person. Our analysis showed that 22% of the analyzedAMIs contain information in at least one of the last logindatabases. The lastb database contains the failed login at-tempts, and therefore, can also be very helpful in retrievinguser account passwords since passwords that are mistyped ortyped too early often appear as user names in this database.There were 187 AMIs that contained a total of 66,601 entriesin their lastb databases. Note that host names gatheredfrom the shell history, the SSH user configuration, and theSSH server connection logs can also provide useful clues toan attacker.

Browser History

Nine AMIs contained a Firefox history file (two concerningroot and seven concerning a normal user). Note that because

Page 16: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Balduzzi etal.analysis• Credentialsforothersystems– AWSsecretkeys(tocontrolEC2servicesofanaccount):67found

– Passwords/secretkeysforothersystems:56found

Finding Total Image RemoteAmazon RDS 4 0 4dDNS 1 0 1SQL 7 6 1MySql 58 45 13WebApp 3 2 1VNC 1 1 0Total 74 54 20

Table 3: Credentials in history files

of ethical concerns, we did not manually inspect the contentsof the browser history. Rather, we used scripts to checkwhich domains had been contacted. From the automatedanalysis of the history file, we discovered that one machinewas used by a person to log into the portal of a Fortune 500company. The same user then logged into his/her personalGoogle email account. Combining this kind of information,history files can easily be used to de-anonymize, and revealinformation about the image’s creator.

Shell History

When we tested the AMI using our test suite, we inspectedcommon shell history files (e.g. �/.history, �/.bash_history,�/.sh_history) that were left on the image when it wascreated. We discovered that 612 AMIs (i.e., 11.54% of thetotal) contained at least one single history file. We found atotal of 869 files that stored interesting information (471 forroot and 398 for generic users), and that contained 158,354lines of command history. In these logs, we identified 74 dif-ferent authentication credentials that were specified in thecommand line, and consequently recorded on file (ref. Ta-ble 3).

For example, the standard MySQL client allows to spec-ify the password from the command line using the -p flag.A similar scenario occurs when sensitive information, suchas a password or a credit card number, is transferred to aweb application using an HTTP GET request. GET re-quests, contrary to POST submissions, are stored on theweb server’s logs. The credentials we discovered belong totwo categories: local and remote.

The credentials in the image group grant an attacker ac-cess to a service/resource that is hosted on the AMI. Incontrast, remote credentials enable the access to a remotetarget. For example, we identified remote credentials thatcan be used to modify (and access) the domain name in-formation of a dynamic DNS account. A malicious userthat obtains a DNS management password can easily changethe DNS configuration, and redirect the tra⌅c of the orig-inal host to his own machines. In addition, we discoveredfour credentials for the Amazon Relational Database Service(RDS) [32] – a web service to set up, operate, and scale arelational database in the Amazon cloud. We also foundcredentials for local and remote web applications for di�er-ent uses (e.g. Evergreen, GlassFish, and Vertica) and fora database performance monitoring service. One machinewas configured with VNC, and its password was specifiedfrom the command line. Finally, we were able to collect 13credentials for MySQL that were used in the authenticationof remote databases.

Recovery of deleted files

In the previous sections, we discussed the types of sensitiveinformation that may be forgotten by the image provider.Unfortunately, the simple solution of deleting this informa-tion before making the image publicly available is not satis-factory from a security point of view.In many file systems, when a user deletes a file, the space

occupied by the file is marked as free, but the content of thefile physically remains on the media (e.g. the hard-disk).The contents of the deleted file are definitely lost only whenthis marked space is overwritten by another file. Utilitiessuch as shred, wipe, sfill, scrub and zerofree make datarecovery di⌅cult either by overwriting the file’s contents be-fore the file is actually unlinked, or by overwriting all thecorresponding empty blocks in the filesystem (i.e., securedeletion or wiping). When these security mechanisms arenot used, it is possible to use tools (e.g., extundelete andWinundelete) to attempt to recover previously deleted files.In the context of Amazon EC2, in order to publish a cus-

tom image on the Amazon Cloud, a user has to prepare herimage using a predefined procedure called bundling. Thisprocedure involves three main steps: Create an image froma loopback device or a mounted filesystem, compress and en-crypt the image, and finally, split it into manageable partsso that it can be uploaded to the S3 storage.The first step of this procedure changes across di�erent

bundling methods adopted by the user (ref. Table 4). Forexample, the ec2-bundle-image method is used to bundlean image that was prepared in a loopback file. In this case,the tool transfers the data to the image using a block leveloperation (e.g. similar to the dd utility). In contrast, if theuser wishes to bundle a running system, she can choose theec2-bundle-vol tool that creates the image by recursivelycopying files from the live filesystem (e.g., using rsync). Inthis case, the bundle system works at the file level.Any filesystem image created with a block-level tool will

also contain blocks marked as free, and thus may containparts of deleted files. As a result, out of the four bundlingmethods provided by Amazon, three are prone to a file un-deletion attack.To show that our concerns have practical security impli-

cations, we randomly selected 1,100 Linux AMIs in four dif-ferent regions (US East/West, Europe and Asia). We thenused the extundelete data recovery utility [5] to analyzethe filesystem, and recover the contents of all deleted files.In our experiment, we were able to recover files for 98% ofthe AMIs (from a minimum of 6 to a maximum of morethan 40,000 files per AMI). In total, we were able to retrieve28.3GB of data (i.e., an average of 24MB per AMI).We collected statistics on the type (Table 5) of the un-

deleted files by remotely running the file command. Notethat in order to protect the privacy of Amazon users, wedid not access the contents of the recovered data, and wealso did not transfer this data out of the vulnerable AMI.The table shows a breakdown of the types of sensitive datawe were able to retrieve (e.g., PDFs, O⌅ce documents, pri-vate keys). Again, note that the Amazon AWS keys are notpassword-protected. That is, an attacker that gains accessto these keys is then able to instantiate Amazon resources(e.g. S3 and AWS services) at the victim’s expense (i.e., thecosts are charged to the victim’s credit card).In our analysis, we verified if the same problem exists for

Windows AMIs. We analyzed some images using the Win-

Page 17: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Balduzzi etal.analysis• Deletedfiles– OneAMIcreationmethoddoesblock-levelcopying

Method Level Vulnerableec2-bundle-vol File-System Noec2-bundle-image Block YesFrom AMI snapshot Block YesFrom VMWare Block Yes

Table 4: Tested Bundle Methods

Type #Home files (/home, /root) 33,011Images (min. 800x600) 1,085Microsoft O⌅ce documents 336Amazon AWS certificates and access keys 293SSH private keys 232PGP/GPG private keys 151PDF documents 141Password file (/etc/shadow) 106

Table 5: Recovered data from deleted files

Undelete tool [31], and were able to recover deleted files inall cases. Interestingly, we were also able to undeleted 8,996files from an o⌅cial image that was published by AmazonAWS itself.

5 Machine FingerprintingIn the previous sections, we presented a number of experi-ments we conducted to assess the security and privacy issuesinvolved in the release and use of public AMIs. The resultsof our experiments showed that a large number of factorsmust be considered when making sure that a virtual ma-chine image can be operated securely (e.g., services must bepatched and information must be sanitized).

A number of the issues we described in the previous sec-tions could potentially be exploited by an attacker (or a ma-licious image provider) to obtain unauthorized remote accessto any running machine that adopted a certain vulnerableAMI. However, finding the right target is not necessarily aneasy task.

For example, suppose that a malicious provider distributesan image containing his own ssh key, so that he can later lo-gin into the virtual machines as root. Unfortunately, unlesshe also adds some kind of mechanism to “call back home”and notify him of the IP address of every new instance, hewould have to brute force all the Amazon IP space to tryto find a running machine on which he can use his creden-tials. To avoid this problem, in this section we explore thefeasibility of automatically

In order to explore the feasibility, from an attacker pointof view, of automatically matching a running instance backto the corresponding AMI, we started our experiment byquerying di�erent public IP registries (ARIN, RIPE, andLAPNIC) to obtained a list of all IPs belonging to the Ama-zon EC2 service for the regions US East/West, Europe andAsia. The result was a set of sub-networks that comprises653,401 distinct IPs that are potentially associated with run-ning images.

For each IP, we queried the status of thirty commonly usedports (i.e., using the NMap tool), and compared the resultswith the information extracted from the AMI analysis. Weonly queried a limited number of ports because our aim wasto be as non-intrusive as possible. (i.e., see Section 6 fora detailed discussion of ethical considerations, precautions,

CandidatesApproach Instances 1 10 50SSH 130,580 2,149 8,869 11,762Services 203,563 7,017 30,345 63,512Web 125,554 5,548 31,651 54,918

Table 6: Discovered Instances

and collaboration with Amazon). For the same reason, weconfigured NMap to only send a few packets per second toprevent any flooding, or denial of service e�ect.Our scan detected 233,228 running instances. This num-

ber may not reflect the exact number of instances there wereindeed running. That is, there may have been virtual ma-chines that might have been blocking all ports.We adopted three di�erent approaches to match and map

a running instance to a set of possible AMIs. The threemethods are based on the comparison of the SSH keys, ver-sions of network services, and web-application signatures.Table 6 depicts the results obtained by applying the three

techniques. The first column shows the number of runninginstances to which a certain technique could be applied (e.g.,the number of instances where we were able to grab the SSHbanner). The last two columns report the number of runningmachines for which a certain matching approach was able toreduce the set of candidate AMIs to either 10 or 50 permatched instance. Since 50 possibilities is a number thatis small enough to be easily brute-forced manually, we canconclude that it is possible to identify the AMI used in morethan half of the running machines.

SSH matching Every SSH server has a host key that isused to identify itself. The public part of this key is usedto verify the authenticity of the server. Therefore, this keyis disclosed to the clients. In the EC2, the host key of animage needs to be regenerated upon instantiation of an AMIfor two reasons: First, a host key that is shared among sev-eral machines makes these servers vulnerable to man-in-the-middle attacks (i.e., especially when the private host key isfreely accessible). Second, an unaltered host key can serveas an identifier for the AMI, and may thus convey sensitiveinformation about the software that is used in the instance.This key regeneration operation is normally performed by

the cloud-init script provided by Amazon. The scriptshould normally be invoked at startup when the image isfirst booted. However, if the image provider either forgetsor intentionally decides not to add the script to his AMI,this important initialization procedure is not performed. Insuch cases, it is very easy for an attacker to match the SSHkeys extracted from the AMIs with the ones obtained froma simple NMap scan. As reported in Table 6, we were ableto precisely identify over 2,100 AMI instances by using thismethod.

Service matching In the cases where the ssh-based iden-tification failed, we attempted to compare the banners cap-tured by NMap with the information extracted from the ser-vices installed on the AMIs. In particular, we compared theservice name, the service version, and (optionally) the ad-ditional information fields returned by the thirty commonports we scanned in our experiment.The service-matching approach is not as precise as the ssh-

based identification. Hence, it may produce false positives if

Page 18: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Response“Theytoldmeit’snottheirconcern,theyjustprovidecomputingpower,”Balduzzi says.“It’slikeifyouuploadnakedpicturestoFacebook.It’snotagoodpractice,butit’snotFacebook’sproblem.”

http://www.forbes.com/sites/andygreenberg/2011/11/08/researchers-find-amazon-cloud-servers-teeming-with-backdoors-and-other-peoples-data/

• AmazonnotifiedcustomerswithvulnerableAMIs• MadeprivateAMIsofnon-responsivecustomers• Newtutorialsforbundlingsystems• Workingonundeleteissues…

Page 19: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Trustmodelsinpubliccloudcomputing

UserB

Securitythreatsinpubliccloudcomputing?

UserA

AdversarialproviderspyingonrunningVMs/data

Cross-userattacksVMimageattacksSide-channelsattacks

Externalattacksagainstinfrastructure

Page 20: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Threatsduetoresourcesharing

UserA

Badguy

AttackeridentifiesoneormorevictimsVMsincloud

2)Launchattacksusingphysicalproximity

1)AchieveadvantageousplacementvialaunchingofVMinstances

ExploitVMMvulnerability Side-channelattackDoS

Page 21: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

1ormoretargetsinthecloudandwewanttoattackthemfromsamephysicalhost

Launchlotsofinstances(overtime),witheachattemptinganattack

Canattackersdobetter?

Page 22: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

1)Cloudcartography

2)Checkingforco-residence

Outlineofamoredamagingapproach:

mapinternalinfrastructureofcloudmapusedtolocatetargetsincloud

checkthatVMisonsameserverastarget- network-basedco-residencechecks- efficacyconfirmedbycovertchannels

Placementvulnerability:attackerscanknowinglyachieveco-residencewithtarget3)Achievingco-residence

bruteforcingplacementinstancefloodingaftertargetlaunches

4)Location-basedattacksside-channels,DoS,escape-from-VM

Page 23: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Picktarget(s) ChooselaunchparametersformaliciousVMs

EachVMchecksforco-residence

Frequentlyachieveadvantageousplacement

CasestudywithAmazon’sEC2

“Cloudcartography”

Cross-VMsidechannelattackstospyonvictim’scomputationalload

Secretdata

1)givennoinsiderinformation2)restrictedby(thespiritof)Amazon’sacceptableusepolicy(AUP)

(usingonlyAmazon’scustomerAPIsandveryrestrictednetworkprobing)

Wewereableto:

Page 24: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

SomeinfoaboutEC2service(attimeofstudy)Linux-basedVMsavailableUsesXen-basedVMmanager

5instancetypes(variouscombinationsofvirtualizedresources)

Type gigs ofRAM EC2ComputeUnits(ECU)

m1.small(default) 1.7 1

m1.large 7.5 4

m1.xlarge 15 8

c1.medium 1.7 5

c1.xlarge 7 20

3“availabilityzones”(Zone1,Zone2,Zone3)

1ECU=1.0-1.2GHz2007Opteronor2007Xeonprocessor

launchparameters

Useraccount

Limitof20instancesatatimeperaccount.Essentiallyunlimitedaccountswithcreditcard.

Page 25: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

(Simplified)EC2instancenetworking

XenVMM

Edgerouters

ExternalIP

ExternalDNS Internal

DNS

Externaldomainname

ExternaldomainnameorIP

InternalIP

InternalIPDom0

IPaddressshowsupintraceroutes

In2009:internalIPsarestaticallyassigned tophysicalservers

Co-residencecheckingviaDom0:onlyhopontraceroutetoco-residenttarget

Page 26: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Checkingforco-residence:CovertchannelsCovertchannelsallowcooperatingsenderandreceivertosendamessagetoeachotherwhileskirtinginformationflowcontrols

HarddiskVM1

Sendertransmits‘1’byfranticlyreadingrandomlocations

Receivertimesreadingofafixedlocation

Sendertransmits‘0’bydoingnothing

VM2

CovertchannelsrequirecontrolofbothVMs:Notdirectlyusefultodetermineco-residencywithtargetvictim

Lampson.ANoteontheConfinementProblem.1973

Page 27: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

AttackerVM

VictimVM

Mainmemory

CPUdatacache

1)Readinalargearray(fillCPUcachewithattackerdata)

2)Busyloop(allowvictimtorun)

3)Measuretimetoreadlargearray(theloadmeasurement)

Checkingforco-residence:SidechannelsAside-channelisanunintentionalleakageofinformationaboutconfidentialprocess

Page 28: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Cache-basedcross-VMloadmeasurementonEC2

RepeatedHTTPgetrequests

Performscacheloadmeasurements

RunningApacheserver

Instancesco-resident Instancesco-resident InstancesNOTco-resident

3pairsofinstances,2pairsco-residentand1not100cacheloadmeasurementsduringHTTPgets(1024bytepage) andwithnoHTTPgets

Page 29: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Repeat3times:1) 20m1.smallAccountA2) 20m1.smallAccountB3) Allpairsw/matchingDom0à send5-bitmessageacrossHDcovertchannel

Experiment

Endedupwith31pairsofco-residentinstancesasindicatedbyDom0IPs

Checkingforco-residence

Result:acorrectly-receivedmessagesentforeverypairofinstances

Zone1Control1 1.164

Zone1Control2 1.027

Zone2Control1 1.113

Zone2Control2 1.187

Zone3Control1 0.550

Zone3Control2 0.436

Co-resident VM 0.242

Duringexperimentalsoperformedpingsto:*2controlinstancesineachzone*co-residentVM

MedianRTT(ms)

Dom0checkworks

RTTtimesalsoindicateco-residence

Page 30: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Picktarget(s) ChooselaunchparametersformaliciousVMs

Cloudcartography

5instancetypes(m1.small,c1.medium,m1.large,m1.xlarge,c1.xlarge)

3“availabilityzones”(Zone1,Zone2,Zone3)

Useraccount

launchparameters

Page 31: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Picktarget(s) ChooselaunchparametersformaliciousVMs

Cloudcartography

5instancetypes(m1.small,c1.medium,m1.large,m1.xlarge,c1.xlarge)

3“availabilityzones”(Zone1,Zone2,Zone3)

launchparameters

Useraccount

Page 32: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

InternalIPaddress

InternalIPadd

ressm

od256

Mapping6,577publicHTTPserversrunningonEC2(Fall2008)

Associatetoeach/24anestimateofAvailabilityzoneandInstanceType

InternalIPExternalIP DNS /24AvailabilityzoneInstanceType

Page 33: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Achievingco-residence“Brute-forcing”co-residence

1,686 publicHTTPserversasstand-in“targets”runningm1.smallandinZone3(viaourmap)

1,785 “attacker”instanceslaunchedover18days

Eachcheckedco-residenceagainstalltargetsusingDom0IP

Results:

78 uniqueDom0IPs

141 /1,686 (8.4%)hadattackerco-resident

AttackerlaunchesmanyVMsoverarelativelylongperiodoftimeintarget’szoneandoftargettype

Experiment:

Page 34: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Achievingco-residence

1)Launch1target VM(AccountA)

2)5minuteslater,launch20“attack”VMs(alternateusingAccountBorC)

Repeatfor10trials:

3)Determineifanyco-residentwithtargetusingDom0IP

4/10trialssucceeded

Instancefloodingneartargetlaunchabusesparallelplacementlocality

Launchmanyinstancesinparallelintoknownzone/typeneartimeoftargetlaunch

Experiment:

Page 35: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Changessince2009

• TurnedoffDom0• VirtualPrivateClouds– Instanceslaunchedintovirtualprivatenetworks– Logicallyisolatednamespace• PreventscloudcartographybasedoninternalIPs

• Scalesignificantlylarger– Liu2013:~450,000serversforEC2

Page 36: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Newerplacementstudies• Varadarajan etal.andXu etal.(USENIX2015)• Newco-residencetests,explorelargervarietyofsettings

• Conclusions:canstillachieveco-residency

Page 37: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Picktarget(s) ChooselaunchparametersformaliciousVMs

EachVMchecksforco-residence

Frequentlyachieveadvantageousplacement

“Cloudcartography”

Sofarwewereableto:

Hardware

Hypervisor

OS1

P1 P2

OS2

P1 P2

DriversDrivers

Thisshouldn’tmatterifVMMprovidesgoodisolation!

Page 38: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Violatingisolation

• Cross-VMside-channelattacks• Degradation-of-Serviceattacks– Guestsmightmaliciouslycontendforresources

– Xen schedulervulnerability• Escape-from-VMvulnerabilities• Resource-freeingattacks

Hardware

OS1

P1 P2

Hypervisor

OS2

P1 P2

Page 39: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

MeasuringResourceContention

• Contentionforthesameresource

39

0

100

200

300

400

500

600

CPU Net Disk Memory Cache

Performan

ceDegrada

tion(%

) LocalXen Testbed

Machine IntelXeonE5430,2.66Ghz

Packages 2, 2coresperpackage

LLCSize 6MB perpackage

Page 40: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Cache-basedloadmeasurementoftrafficratesonEC2

3trialswith1pairofco-residentinstances:1000cacheloadmeasurementsduring0,50,100,or200HTTPgets(3Mbytepage)perminutefor~1.5mins

Varyingratesofwebtraffic

Performscacheloadmeasurements

RunningApacheserver

Page 41: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

1)Cloudcartography

2)Checkingforco-residence

4)Side-channelinformationleakage

Whatcancloudprovidersdo?- RandomInternalIPassignment

3)Achievingco-residence

- Isolateeachuser’sviewofinternaladdressspace

Possiblecounter-measures:

- HideDom0fromtraceroutes

- Allowuserstooptoutofmultitenancy

- Hardwareorsoftwarecountermeasurestostopleakage[Ber05,OST05,Page02,Page03,Page05,Per05]- Improvedperformanceisolation

Amazonprovidesdedicatedinstancesnow.Theycostmore.

Amazondoesn’treportDom0intraceroutes anymore

NewerinstancesonEC2usevirtualprivatenetworksby

default

Page 42: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Nexttime:Side-channelattacks

• Yarom &FalknerFlush+Reload attackonRSA• Meltdown

Page 43: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

1)Cloudcartography

2)Checkingforco-residence

4)Side-channelinformationleakageResource-freeingattacks

Whatcancloudprovidersdo?- RandomInternalIPassignment

3)Achievingco-residence

- Isolateeachuser’sviewofinternaladdressspace

Possiblecounter-measures:

- HideDom0fromtraceroutes

- Allowuserstooptoutofmultitenancy

- Hardwareorsoftwarecountermeasurestostopleakage[Ber05,OST05,Page02,Page03,Page05,Per05]- Improvedperformanceisolation

Amazonprovidesdedicatedinstancesnow.

Theycostalotmore.

Amazondoesn’treportDom0intraceroutes anymore

NewerinstancesonEC2usevirtualprivatenetworksby

default

Page 44: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Prime+Trigger+Probe combinedwithdifferentialencodingtechniquegiveshighbandwidthcross-VMcovertchannelonEC2

See[Xu etal.,“AnExplorationofL2CacheCovertChannelsinVirtualizedEnvironments”,CCSW2011]

Moreoncache-basedphysicalchannels

KeystroketiminginexperimentaltestbedsimilartoEC2m1.smallinstances

CPU1Core1 Core2

CPU2Core1 Core2

AMDOpterons

Page 45: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Moreoncache-basedphysicalchannels

KeystroketiminginexperimentaltestbedsimilartoEC2m1.smallinstances

CPU1Core1 Core2

CPU2Core1 Core2

AMDOpterons

Prime+Trigger+Probe combinedwithdifferentialencodingtechniquegiveshighbandwidthcross-VMcovertchannelonEC2

See[Xu etal.,“AnExplorationofL2CacheCovertChannelsinVirtualizedEnvironments”,CCSW2011]

Page 46: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Moreoncache-basedphysicalchannels

KeystroketiminginexperimentaltestbedsimilartoEC2m1.smallinstances

CPU1Core1 Core2

CPU2Core1 Core2

AMDOpterons

Prime+Trigger+Probe combinedwithdifferentialencodingtechniquegiveshighbandwidthcross-VMcovertchannelonEC2

See[Xu etal.,“AnExplorationofL2CacheCovertChannelsinVirtualizedEnvironments”,CCSW2011]

Page 47: Cloud security - Cornell UniversityInfrastructure-as-a- Software-as-a-service service Cloud providers Cloud computing NIST: Cloud computing is a model for enabling convenient, on-demand

Moreoncache-basedphysicalchannels

KeystroketiminginexperimentaltestbedsimilartoEC2m1.smallinstances

CPU1Core1 Core2

CPU2Core1 Core2

Weshowthatcache-loadmeasurementsenablecross-VMkeystrokedetection

Keystroketimingofthisformmightbesufficientforthepasswordrecoveryattacksof[Song,Wagner,Tian01]

AMDOpterons

VMspinnedtocore

Prime+Trigger+Probe combinedwithdifferentialencodingtechniquegiveshighbandwidthcross-VMcovertchannelonEC2

See[Xu etal.,“AnExplorationofL2CacheCovertChannelsinVirtualizedEnvironments”,CCSW2011]