2010年4月8日
admin 1,353 views
intval()使用不当导致安全漏洞的分析
author: xy7#80sec.com
from:http://www.80vul.com/pch/
一 描叙
intval函数有个特性:”直到遇上数字或正负符号才开始做转换,再遇到非数字或字符串结束时(\0)结束转换”,在某些应用程序里由于对intval函数这个特性认识不够,错误的使用导致绕过一些安全判断导致安全漏洞.
二 分析
PHP_FUNCTION(intval)
{
zval **num, **arg_base;
int base;
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &num) == FAILURE) {
WRONG_PARAM_COUNT;
}
base = 10;
break;
case 2:
if (zend_get_parameters_ex(2, &num, &arg_base) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(arg_base);
base = Z_LVAL_PP(arg_base);
break;
default:
WRONG_PARAM_COUNT;
}
RETVAL_ZVAL(*num, 1, 0);
convert_to_long_base(return_value, base);
}
阅读全文…
2010年4月5日
admin 14,106 views
来源packetstorm.com
Web Application Auditing and Exploitation
By ReZEN
Index Title
Index
What is a Web Application
Intro To PHP
Function Exploitation Overview
Exploitable Functions
Examples
Application Assisted Auditing
Credits
Gr33tz / Fuckz
What is a “WebApp”?
In software engineering, a web application—sometimes
called a webapp and much less frequently a
weblication—is an application that’s accessed with a web
browser over a network such as the Internet or an
intranet. Web applications are popular due to the
ubiquity of the browser as a client, sometimes called a
thin client. The ability to update and maintain web
applications without distributing and installing software
on potentially thousands of client computers is a key
reason for their popularity. Web applications are used to
implement webmail, online retail sales, online auctions,
wikis, discussion boards, weblogs, MMORPGs, and many
other functions.
What is a “WebApp”? (cont.)
阅读全文…
2010年4月3日
admin 1,892 views
浅谈Local File Disclosure漏洞的利用
本文首发黑防1003期,版权归作者和黑防所有,未经允许请勿转载。
hackerxwar [0x50sec]
文件泄露漏洞就是允许我们查看原本不能查看的有权限访问的任意文件文件,如php文件的源代码,保存数据库帐号和密码的连接文件,服务器的帐号信息文件、配置文件,等等。由此导致了严重的安全问题。比如知道了mysql数据库的帐号信息可以尝试登录mysql,或者phpmyadmin等,继而直接into outfile一个shell,或者登录后台;读源代码也使黑盒的测试变成了白盒,更加方便入侵者查找其他漏洞,降低了入侵的难度。
导致文件泄露漏洞的原因和常见利用方法
导致文件泄露漏洞的原因无非就是readfile()、file_get_contents()、fopen()、file()、fgets()、fgetc()
等等文件操作函数的参数检查不严格导致的,此外还有mysql有file_priv权限的load_file()函数等。文件操作函数参数可能是用户直接GPC输入的数据,也可能是数据库里保存的文件路径等。
关于lfd的利用其实就是读文件,常见的有:
如果后台登录密码写在配置文件里,直接读密码进后台
读mysql数据库连接文件,尝试登录mysql或phpmyadmin
对于mysql4.x的版本可以查看表名和数据库名等配合sql注射
读取/etc/passwd文件、数据库密码等等,配合社会工程学尝试登录ftp、网站后台等等
还有就是通过读php文件源代码来挖掘别的漏洞
但是有些情况下读文件也不是很顺利,这里就浅谈一下这些情况,就当抛砖引玉。
阅读全文…
2010年3月30日
admin 1,522 views
关于magic_quotes_sybase
author: ryat#wolvez.org
team:http://www.80vul.com
date:2009-04-14
一 描叙
magic_quotes_gpc为on时,php在注册变量时会调用addslashes()函数处理[既转义单引号、双引号、反斜线和nullbyte],但php.ini中还有另外一个选项影响着magic_quotes_gpc和addslashes()函数:当php.ini设置magic_quotes_sybase为on时会覆盖magic_quotes_gpc为on的处理,然而magic_quotes_sybase仅仅是转义了nullbyte和把’变成了”
二 分析
先来看下addslashes的php源码:
// string.c
PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free TSRMLS_DC)
{
return php_addslashes_ex(str, length, new_length, should_free, 0 TSRMLS_CC);
}
阅读全文…
2010年3月30日
admin 1,420 views
当magic_quotes_gpc=off
author: ryat#www.wolvez.org
team:http://www.80vul.com
date:2009-04-10
一、综述
magic_quotes_gpc是php中的一个安全选项,在php manual中对此有如下描述:
When on, all ‘ (single-quote), ” (double quote), \ (backslash) and NULL characters are escaped with a backslash automatically. This is identical to what addslashes() does
虽然magic_quotes_gpc有助于提升程序的安全性并且在php中默认开启,但同时也带来了其他的一些问题,因此在php6中将去掉此选项。
二、当magic_quotes_gpc=off
考虑到部分服务器关闭了magic_quotes_gpc或者其他的一些原因[如影响功能等],很多程序在如magic_quotes_gpc=off下自己实现一个代码来模拟magic_quotes_gpc=on的情况. 如下面的一段代码:
阅读全文…
2010年3月30日
admin 1,558 views
安全模式下exec等函数安全隐患
author: 80vul-B
team:http://www.80vul.com
date:2009-05-27
updata:2009-6-19
—————–updata—————————————
昨天php5.2.10出来了,fix了PCH-006里提到的bug:
Fixed bug #45997 (safe_mode bypass with exec/system/passthru (windows only))
然而遗憾的是还有问题,看看php是咋fix这个的:
…
b = strrchr(cmd, PHP_DIR_SEPARATOR);
#ifdef PHP_WIN32
if (b && *b == ‘\\’ && b == cmd) {
// 注意标红的代码:p
php_error_docref(NULL TSRMLS_CC, E_WARNING, “Invalid absolute path.”);
goto err;
}
#endif
…
阅读全文…
2010年3月29日
admin 2,687 views
这么好的文章还是忍不住要转载一下。来源文章都写清楚了。
==Ph4nt0m Security Team==
Issue 0×03, Phile #0×06 of 0×07
|=—————————————————————————=|
|=———————=[ 高级PHP应用程序漏洞审核技术 ]=———————=|
|=—————————————————————————=|
|=—————————————————————————=|
|=———————-=[ By www.80vul.com ]=————————=|
|=————————=[ <www.80vul.com> ]=————————–=|
|=—————————————————————————=|
[目录]
1. 前言
2. 传统的代码审计技术
3. PHP版本与应用代码审计
4. 其他的因素与应用代码审计
5. 扩展我们的字典
5.1 变量本身的key
5.2 变量覆盖
5.2.1 遍历初始化变量
5.2.2 parse_str()变量覆盖漏洞
5.2.3 import_request_variables()变量覆盖漏洞
5.2.4 PHP5 Globals
5.3 magic_quotes_gpc与代码安全
5.3.1 什么是magic_quotes_gpc
5.3.2 哪些地方没有魔术引号的保护
5.3.3 变量的编码与解码
5.3.4 二次攻击
5.3.5 魔术引号带来的新的安全问题
5.3.6 变量key与魔术引号
5.4 代码注射
5.4.1 PHP中可能导致代码注射的函数
5.4.2 变量函数与双引号
5.5 PHP自身函数漏洞及缺陷
5.5.1 PHP函数的溢出漏洞
5.5.2 PHP函数的其他漏洞
5.5.3 session_destroy()删除文件漏洞
5.5.4 随机函数
5.6 特殊字符
5.6.1 截断
5.6.1.1 include截断
5.6.1.2 数据截断
5.6.1.3 文件操作里的特殊字符
6. 怎么进一步寻找新的字典
7. DEMO
8. 后话
9. 附录
阅读全文…
2010年3月22日
admin 21,909 views
From;http://www.milw0rm.com/papers/381
Name : Finding vulnerabilities in PHP scripts FULL ( with examples )
Author : SirGod
Email : sirgod08@gmail.com
Contents :
1) About
2) Some stuff
3) Remote File Inclusion
3.0 – Basic example
3.1 – Simple example
3.2 – How to fix
4) Local File Inclusion
4.0 – Basic example
4.1 – Simple example
4.2 – How to fix
5) Local File Disclosure/Download
5.0 – Basic example
5.1 – Simple example
5.2 – How to fix
阅读全文…
2010年3月5日
admin 2,145 views
一款国外免费的源码审计工具-含linux下版本,RATS。刚刚装上。
RATS
Welcome to RATS – Rough Auditing Tool for Security
RATS – Rough Auditing Tool for Security – is an open source tool developed and maintained by Secure Software security engineers. Secure Software was acquired by Fortify Software, Inc. RATS is a tool for scanning C, C++, Perl, PHP and Python source code and flagging common security related programming errors such as buffer overflows and TOCTOU (Time Of Check, Time Of Use) race conditions.
阅读全文…