duanjian4331 2014-03-08 09:29
浏览 41
已采纳

Php和代码注入

The website for a client of mine continues to be "hacked" (I didn't do the website).The hacked pages contain a js script that loads an image and audio from youtube (Lol). Every page was modified and every page has a "news banner" .I'm pretty sure the problem is this part

    <?php 
$ul = new NewsList; 
$ul->Load(3); 
if($ul->Current() == null){ ?> 
<?php   } 
else{ 
for(; $ul->Current() != null; $ul->Next()){ 
$new = $ul->Current(); 

the complete implementation of this NewsList : http://pastebin.com/WuWjcJ4p

I'm not a php programmer so I don't get where the problem is....I'm not asking that someone going to explain every line, maybe only an advice , thank you

  • 写回答

1条回答 默认 最新

  • dpxyfa4718 2014-03-08 09:34
    关注

    Sounds like an SQL injection.

    I believe the loadById() method is injectable (depending on how you call it).

    Here is a way to strengthen it :

        function LoadById($id){
                $this->news = array();
                $this->current = 0;
                $this->total = 0;
    
                $ndb = new NewsDB('news');
                $result = $ndb->_query("SELECT * FROM ".$ndb->table." WHERE id = " . intval($id));
                $new = mysql_fetch_assoc($result);
                $n = new News($new['id'], $new['titolo'], $new['data'], $new['contenuto'], $new['img']);
                array_push($this->news, $n);
                unset($n);
    
                $this->total = 1;
        }
    

    Someone might have stolen the passwords from administration using this security flaw and edited the articles from the back-office.

    So I suggest you change this code, then change the passwords, delete all php sessions, and finally edit your articles to remove this "news banner".

    Note that it might as well be a stored XSS. Do you have a system which allows to comment the news?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有人能看一下我宿舍管理系统的报修功能该怎么改啊?链表那里总是越界
  • ¥15 cs loadimage运行不了,easyx也下了,没有用
  • ¥15 r包runway详细安装教程
  • ¥15 Html中读取Json文件中数据并制作表格
  • ¥15 谁有RH342练习环境
  • ¥15 STM32F407 DMA中断问题
  • ¥15 uniapp连接阿里云无法发布消息和订阅
  • ¥25 麦当劳点餐系统代码纠错
  • ¥15 轮班监督委员会问题。
  • ¥20 关于变压器的具体案例分析