[TOOL] Anti-Ptrace Linux LKM

From: support@securiteam.com
Date: 03/30/03

  • Next message: support@securiteam.com: "[UNIX] Alexandria-dev / SourceForge Multiple Vulnerabilities"
    From: support@securiteam.com
    To: list@securiteam.com
    Date: 30 Mar 2003 15:57:17 +0200
    
    

    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

    In the US?

    Contact Beyond Security at our new California office
    housewarming rates on automated network vulnerability
    scanning. We also welcome ISPs and other resellers!

    Please contact us at: 323-882-8286 or ussales@beyondsecurity.com
    - - - - - - - - -

      Anti-Ptrace Linux LKM
    ------------------------------------------------------------------------

    DETAILS

    The following Linux LKM allows an administrator to disable the ptrace
    abilities under the 2.4.x kernels.

    Tool source:
    #!/bin/sh
    # MAKE ME EXECUTABLE !!!
    #
    # root@Hogwarts:/home/sacrine/TEST# chmod +x anti-ptrace
    # root@Hogwarts:/home/sacrine/TEST# ./anti-ptrace
    # [+] making anti-ptrace.c: OK
    # [+] compiling the script: OK
    # [+] loading the module : OK
    #

    echo -n " [+] making anti-ptrace.c: "
    cat > anti-ptrace.c <<NETRIC

    /*
     * Noodoplossing voor de ptrace race vuln
     * anti-ptrace.c by sacrine
     * netric.org
     */

    #define __KERNEL__
    #define MODULE
    #define LINUX

    #include <linux/module.h>
    #include <linux/kernel.h>
    #include <linux/types.h>
    #include <linux/version.h>
    #include <linux/slab.h>
    #include <linux/sched.h>
    #include <linux/fs.h>
    #include <linux/ctype.h>
    #include <linux/tty.h>
    #include <sys/syscall.h>

    #include <linux/ptrace.h>

    long (*o_ptrace) ( pid_t pid,
       void *addr,
       void *data );

    extern void* sys_call_table[];

    int anti_ptrace( pid_t pid,
       uid_t uid,
       void *addr,
       void *data )
    {
       uid_t o_uid;

       if(current->uid == 0)
         {
     return(o_ptrace(pid,addr,data));
         }
       
       printk("warning: ptrace(); violation\n"
      "pid=[%i] uid=[%i]\n"
      ,current->pid
      ,current->uid);
       
       console_print("warning: non-root users are not allowed to use
    ptrace();\n");
       return EPERM;
    }

    int init_module(void)
    {
       o_ptrace=sys_call_table[SYS_ptrace];
       sys_call_table[SYS_ptrace]=anti_ptrace;
       
       printk("anti-ptrace kernel module loaded with pid=[%i]\n",
      current->pid);
       
       return(0);
    }

    void cleanup_module(void)
    {
       sys_call_table[SYS_ptrace]=o_ptrace;
       printk("anti-ptrace kernel module ended with pid=[%i]\n",
      current->pid);
    }

    NETRIC
    echo "OK";
    echo -n " [+] compiling the script: ";
    gcc -c anti-ptrace.c -I/lib/modules/$(uname -r)/build/include
    echo "OK";
    echo -n " [+] loading the module : ";
    /sbin/insmod anti-ptrace.o >/dev/null
    echo "OK";

    # sacrine [Netric Security]

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:sacrine@netric.org> sacrine.

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

    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.


  • Next message: support@securiteam.com: "[UNIX] Alexandria-dev / SourceForge Multiple Vulnerabilities"

    Relevant Pages

    • Re: [security bulletin] HPSBTU02211 SSRT071326 rev.1 - HP Tru64 UNIX Running the dop command, Lo
      ... HP Software Security Response Team ... UNIX Operating System running the dop command. ... privileges of the root user. ... echo "HP Security bulletin code identification: ...
      (Bugtraq)
    • [EXPL] INN Security Problems Allow Gaining of news Privileges
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... INN separates hosts that feed you news from those ... echo "* Local inews uid news exploit *" ... mkdir -p $TMPDIR ...
      (Securiteam)
    • [NEWS] iPlanet WebServer Vulnerable to Remote Root Compromise
      ... Beyond Security would like to welcome Tiscali World Online ... review the logs within iPlanet Admin Server. ... This vulnerability can not be exploited on a 6.* version because XSS was ...
      (Securiteam)
    • RE: ICMP (Ping)
      ... Regarding the oft cited admonition against "security by obscurity": ... ICMP inside the firewall. ... ICMP echo is a useful diagnostic ... Symantec is the Diamond sponsor. ...
      (Security-Basics)
    • [EXPL] UnixWare 7.1.1 Scoadminreg.cgi Local Exploit
      ... 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 CGI is part of the UnixWare 7 Webtop package that is ... echo "jGgM root exploit" ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
      (Securiteam)