mysql被一句木马入侵,请问如何防?

petfoodstore 2011-03-03 02:46:14
mysql被一句<?php eval($_POST[..]);?>木马入侵,请问如何防?
...全文
6132 13 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
aocaopo 2011-03-28
  • 打赏
  • 举报
回复
数据库是 插入了 php一句话木马是 执行不了的。
是你的站 被别人 拿到了webshell 然后 修改了代码

或者是某些上传漏洞
daly2008 2011-03-06
  • 打赏
  • 举报
回复
[Quote=引用楼主 petfoodstore 的回复:]
mysql被一句<?php eval($_POST[..]);?>木马入侵,请问如何防?
[/Quote]
防sql注入,在数据入库时,可以使用mysql_escape_string.在页面输入数据的时候,使用htmlspecialchars
genshing 2011-03-05
  • 打赏
  • 举报
回复
禁止掉eval
ihefe 2011-03-03
  • 打赏
  • 举报
回复
禁用
php.ini

disable_functions = phpinfo,eval
落叶秋2020 2011-03-03
  • 打赏
  • 举报
回复


/* 过滤_GET_POST_COOKIE_SESSION_FILES过来变量------------------------------------------------------------- */
foreach ($_GET as $get_key=>$get_var)
{
if (is_numeric($get_var)) {
$get[strtolower($get_key)] = get_int($get_var);
}else{
$get[strtolower($get_key)] = get_str($get_var);
}
}
/* 过滤所有POST过来的变量 */
foreach ($_POST as $post_key=>$post_var)
{
if (is_numeric($post_var)) {
$post[strtolower($post_key)] = get_int($post_var);
} else {
$post[strtolower($post_key)] = get_str($post_var);
}
}
foreach ($_POST as $post_key=>$post_var)
{
if (is_numeric($post_var)) {
$post[strtolower($post_key)] = get_int($post_var);
} else {
$post[strtolower($post_key)] = get_str($post_var);
}
}
/* 过滤函数 */
//整型过滤函数
function get_int($number)
{
return intval($number);
}
//字符串型过滤函数
function get_str($string)
{
if (!get_magic_quotes_gpc()) {
return addslashes($string);
}
return $string;
}





h2ero 2011-03-03
  • 打赏
  • 举报
回复
过滤不严,看下<?php eval($_POST[..]);?>在你的那个字段 然后找到写入该字段的php页面,把要写入数据库的内容先过滤 转义 下
petfoodstore 2011-03-03
  • 打赏
  • 举报
回复
就找不到相应被入侵原因,烦恼中
请各位大哥指导一下
[Quote=引用 5 楼 hst0012010 的回复:]
如果是入侵者放上去的删除呗,找出被入侵的原因
如果是你的系统需要这样,那么验证一下,比如:

PHP code

if ($_POST['pass']=='123'){
eval($_POST['some code']);
}
[/Quote]
lazyboy_wu 2011-03-03
  • 打赏
  • 举报
回复
看htmlspecialchars能帮助你吗?难道你想转义内容吗?
  • 打赏
  • 举报
回复
如果是入侵者放上去的删除呗,找出被入侵的原因
如果是你的系统需要这样,那么验证一下,比如:

if ($_POST['pass']=='123'){
eval($_POST['some code']);
}
ImN1 2011-03-03
  • 打赏
  • 举报
回复
估计ini中没有打开安全转义的开关,只能自己对post过来的数据先做转义咯
首先把"<"转义,后面基本就认为是字符串了

写程序时先要看看phpinfo服务器的环境设置
life169 2011-03-03
  • 打赏
  • 举报
回复
eval($_POST[..]); 应该会报错的呀

20,398

社区成员

发帖
与我相关
我的任务
社区描述
“超文本预处理器”,是在服务器端执行的脚本语言,尤其适用于Web开发并可嵌入HTML中。PHP语法利用了C、Java和Perl,该语言的主要目标是允许web开发人员快速编写动态网页。
phpphpstorm 技术论坛(原bbs)
社区管理员
  • 开源资源社区
  • phpstory
  • xuzuning
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧