<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=SystemsSec_2016W_Lecture_15</id>
	<title>SystemsSec 2016W Lecture 15 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=SystemsSec_2016W_Lecture_15"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=SystemsSec_2016W_Lecture_15&amp;action=history"/>
	<updated>2026-06-02T23:06:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=SystemsSec_2016W_Lecture_15&amp;diff=20808&amp;oldid=prev</id>
		<title>Jsimpson: initial formatting and editing of notes</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=SystemsSec_2016W_Lecture_15&amp;diff=20808&amp;oldid=prev"/>
		<updated>2016-03-10T04:53:39Z</updated>

		<summary type="html">&lt;p&gt;initial formatting and editing of notes&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The two assigned readings for this class were analysed in small groups to determine which sections should be discussed, then the class had an open discussion on each section.&lt;br /&gt;
&lt;br /&gt;
== Paper: On the effectiveness of address-space randomization ==&lt;br /&gt;
* What is [https://en.wikipedia.org/wiki/PaX PaX]?&lt;br /&gt;
** patches put together to harden Linux&lt;br /&gt;
** Mainline kernel has adopted the address space layout randomization (ASLR) mechanism&lt;br /&gt;
&lt;br /&gt;
* Pool of entropy is used to decide where to load sections of executable&lt;br /&gt;
* Executables are in the ELF format, consisting of different sections. Each section can be loaded into different areas of memory&lt;br /&gt;
* for Intel x86 you get 16 bits of entropy for ASLR&lt;br /&gt;
** Its not enough since it doesn&amp;#039;t take long to try 32,000 tries&lt;br /&gt;
* 24 bits of ASLR entropy is 16 million&lt;br /&gt;
** still possible to brute force&lt;br /&gt;
&lt;br /&gt;
* When any of the three delta (randomization) variables are leaked/stolen it&amp;#039;s trivial for the attacker to know the addresses of everything&lt;br /&gt;
&lt;br /&gt;
* In the paper the authors use a return-to-libc attack, bypassing the stack protection&lt;br /&gt;
** uses return addresses on the stack&lt;br /&gt;
** any process on Unix uses the libc library. ie. the functions are always loaded into every program&lt;br /&gt;
*** other os&amp;#039;es have a similar library&lt;br /&gt;
** each executable contains the system() system call&lt;br /&gt;
*** allows the program to start a shell&lt;br /&gt;
&lt;br /&gt;
* What if the defender turns off execution on the stack&lt;br /&gt;
** This method is called Write or Execute pages (W or X)&lt;br /&gt;
** return-to-libc bypasses the memory protection from W or X&lt;br /&gt;
&lt;br /&gt;
* The problem introduced in the paper is how can they find the libc library when ASLR and W or X is used&lt;br /&gt;
** This is a derandomization attack&lt;br /&gt;
** Try jumping to addresses at random&lt;br /&gt;
** If the address to jump to was invalid, a segfault occurs&lt;br /&gt;
** The authors assume that the service starts a new process for each request (Default Apache web server behaviour)&lt;br /&gt;
*** Its costly to spawn new processes to do work, but it&amp;#039;s more secure since it&amp;#039;s an entirely separate memory space&lt;br /&gt;
*** In cases where the service doesn&amp;#039;t fork requests to a new process, it&amp;#039;s common for the memory to be re-randomized after a segfault&lt;br /&gt;
&lt;br /&gt;
* the attackers want to find the delta_mmap variable&lt;br /&gt;
** contains the randomization code&lt;br /&gt;
*** keys to the kingdom&lt;br /&gt;
*** allows you to know how ASLR randomizes the memory&lt;br /&gt;
&lt;br /&gt;
* It&amp;#039;s important to understand the assumptions that the paper makes when doing these attacks&lt;br /&gt;
* Assumptions can make the attack much easier&lt;br /&gt;
&lt;br /&gt;
* 64 bit systems running 64 bit processes has a huge memory space that allows for much more randomization of memory addresses&lt;br /&gt;
** at least 40 bits of entropy&lt;br /&gt;
** Increases the number of tries&lt;br /&gt;
&lt;br /&gt;
* Server&amp;#039;s crashing all the time should be a big notice that there&amp;#039;s an issue but program&amp;#039;s aren&amp;#039;t designed with that in thought&lt;br /&gt;
** ie. an attacker&lt;br /&gt;
** investigating in the Apache web server attack&lt;br /&gt;
*** block the IP address that&amp;#039;s causing the process to crash&lt;br /&gt;
*** See the data of the incoming request to determine if it&amp;#039;s malicious or not&lt;br /&gt;
** pausing the process stops the hacker but causes a DoS for the users of the service&lt;br /&gt;
&lt;br /&gt;
== Paper: The Geometry of Innocent Flesh on the Bone: Return-into-libc without Function Calls(on the x86) ==&lt;br /&gt;
&lt;br /&gt;
* shows a new way of organizing [https://en.wikipedia.org/wiki/Return-to-libc_attack return-into-libc exploits]&lt;br /&gt;
* static analysis can be used to find code sequences for the return-into-libc attack&lt;br /&gt;
* basic idea: put a return address on the stack - but not the return address of a function - an arbitrary instruction that&amp;#039;s near the end of the function&lt;br /&gt;
** runs the last few instructions of the function, then it does a return&lt;br /&gt;
** that return address is then another jump into arbitrary instructions, repeating the above&lt;br /&gt;
&lt;br /&gt;
* This allows you to assemble arbitrary functions&lt;br /&gt;
* static analysis allows you to use libraries other than libc&lt;br /&gt;
* with enough functions, you&amp;#039;re able to build any sort of exploit&lt;br /&gt;
* each sequence of useful code from the end of functions are called &amp;quot;gadgets&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* How are sequences chained together?&lt;br /&gt;
** you push many return addresses and all the needed parameters&lt;br /&gt;
** need a lot of bytes to perform this type of attack&lt;br /&gt;
&lt;br /&gt;
* Once you figure out where the library is randomly loaded, its trivial to jump to any function in the library&lt;br /&gt;
&lt;br /&gt;
== What have we learned about buffer overflows? (attack and defence) ==&lt;br /&gt;
&lt;br /&gt;
* What lessons have we learned?&lt;br /&gt;
** Don&amp;#039;t use unsafe languages (ie. C, C++)&lt;br /&gt;
** attacks are very specific, but potentially robust&lt;br /&gt;
** Side: Pwn2Own - if you compromise the machine/device, you take it home or get a reward&lt;br /&gt;
*** Attackers chain together many, many techniques to pwn devices&lt;br /&gt;
*** This stuff is real, but it is not easy. Depends on lots of little tricks&lt;br /&gt;
* What&amp;#039;s required to perform a memory corruption attack?&lt;br /&gt;
** access to the same system&lt;br /&gt;
** same programs, patches, versions&lt;br /&gt;
** All of these are required because memory corruption attacks are fragile and very platform specific&lt;br /&gt;
* How do you defeat these attacks in general?&lt;br /&gt;
** software distribution&lt;br /&gt;
*** all the code that we put out there are the same - we all run the same code/binaries&lt;br /&gt;
*** if attacker has the same binaries, they can study them and develop attacks&lt;br /&gt;
* Its silly that we can do crazy things to binaries (ie. crash them 30,000 times) without the binary doing anything&lt;/div&gt;</summary>
		<author><name>Jsimpson</name></author>
	</entry>
</feed>