리눅스 바이러스 걸리다 ㅠ.ㅠ

Posted 2008/04/23 11:39 by silverbug

리눅스 바이러스에 감염됐습니다. -_-!! 아헹헹...

증상(임의로 작성)
root     12232  0.0  0.0  2744  780 pts/2    R    11:28   0:00 ps -aux
root     12231  0.0  0.0  2744  780 pts/2    R    11:28   0:00 ls -al
root     12222  0.0  0.0  2744  780 pts/2    R    11:28   0:00 hostname

이런식으로 프로세스가 계속 살아 있는겁니다. 실행하고 죽어야 할넘들이..

첨에 proc 파일 시스템에 이상이 있나 해서.. 그냥 넘겼었는데....... 설마 바이러스 일줄이야..

다른 시스템하고 비교해보니... 이거 파일 사이즈가 완전 틀리네요.. 같은 rpm 버전인데...

커널 루트킷이라 판단하고.. 모든 시스템콜 주소를 찍어서 System.map 파일과 비교 했더니..

이상무......

파일 분석 결과.. 특정 자주 쓰는 명령어(ls, echo, tar, cat 등등등) 파일들을 윈도우 바이러스처럼 악성코드가 달라 붙네요... 도스 공격하는 형태와 백도어...

rm -rf /bin/mkdir
ls -al /bin/mkdir
ls: /bin/mkdir: 그런 파일이나 디렉터리가 없음.

touch /bin/mkdir
ls -al mkdir
-rwxr-xr-x    1 root     root        20111 10:29  2003 /bin/mkdir

어이 없는 현상... 즉 ls가 감염되어 있었던 것입니다.

ls를 실행하면 특정 파일들을 다 감염시키는거지요..

얼마나 많은 파일들이 변조 됐나 확인 하기 위해.. rpm으로 체크섬 검사.. (즉 파일 변조 유무 검사를 시행했습니다.)

rpm -Vqa 명령사용.

여기서 잠깐 V옵션에 대해서 알아보죠..

출력 결과 형태..
SM5DLUGT c <file>

옵션 설명..

  • S is the file size.

  • M is the file's mode.

  • 5 is the MD5 checksum of the file.

  • D is the file's major and minor numbers.

  • L is the file's symbolic link contents.

  • U is owner of the file.

  • G is the file's group.

  • T is the modification time of the file.

  • c appears only if the file is a configuration file. This is handy for quickly identifying config files, as they are very likely to change, and therefore, very unlikely to verify successfully.

  • <file> is the file that failed verification. The complete path is listed to make it easy to find.


즉... 여기서 파일 사이즈(S) 가 붙어서 나오면..(실행 화일에..) 문제가 있다는 말이죠... (즉 변조가 됐다는 말이겠죠.. 원래 사이즈보다 크거나 작다면...)

상당수가 나왔습니다. -_-;

일단 변조된 파일들의 rpm 패키지를 찾고.. (rpm -qf 파일명)

rpm 패키지들을 한꺼번에 다운 받은후...

rpm -ivh *.rpm --force 강제로 설치...

현재까지는 아무 이상 없습니다..

--------------------------------------------------------------------

샘플로 바이러스 하나 놔두고 분석 좀 제대로 해볼껄 ㅠ.ㅠ 다 지워져서 아쉽네요..




스왑(swap) 파티션, 파일 만들기

Posted 2007/07/23 20:59 by silverbug
swap 파티션 만들기
fdisk 에서 82번 스왑 만든다 (/dev/hda10 blocks 52888)
mkswap -c /dev/hda10
swapon /dev/hda10

swap 파일 만들기
dd if=/dev/zero of=/swap bs=1024 count=8192 (8MB 스왑파일)
mkswap -c /swap 8192
swapon /swap

Bluetooth - 음악듣기 (Linux)

Posted 2007/07/23 20:58 by silverbug
Bluetooth-alsa 음악듣기

Check btsco out from cvs
cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/bluetooth-alsa login
cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/bluetooth-alsa co btsco

Compile:
./bootstrap
./configure
make
make install
make maintainer-clean

SCO (two-way voice quality audio) you need a kernel with the emu10k1 driver selected.

Build the kernel module:
cd kernel
make
make install
depmod -e
make clean

insert the module
modprobe snd_bt_sco

stop the esound controller if it's running via
esdctl stop

run
hciconfig hci0 voice 0x0060

run the handler
btsco bdaddress

send and receive audio from the headset
aplay -B 1000000 -D plughw:Headset sound.wav

Stereo (A2DP) Streaming
mpg123 --au - file.mp3 | ./a2play 00:0D:3C:30:32:AD
mpg123 --au - file.mp3 | sbc/sbcenc - | ./sbc/rcplay 00:0D:3C:30:32:AD -
./a2play -s -d -r 44100 00:0D:3C:30:32:AD /dev/dsp

The A2DP sink code receives a stream from another device. Run it with:
hciconfig hci0 class 0x200404
sdptool add A2SNK
./a2recv

한글 Font 새로 추가하기

Posted 2007/07/23 20:57 by silverbug
Font 추가

추가할 폰트를 /usr/share/fonts/korean/폰트디렉만들기/ 넣는다.

/usr/share/fonts/korean/폰트디렉/ 으로 이동 후
mkfontscale
mkfontdir
ttmkfdir
fc-cache -fv

Success ~

리눅스 콘솔상에서 첨부 메일 보내기

Posted 2007/07/23 20:56 by silverbug
uuencode 파일명 동일화일명 | mail -s "제목" 수신자이메일


NETPOT DHCP IP 받아오기

Posted 2007/07/23 20:54 by silverbug
이놈의 한국 통신이 전에는 안그러더니 바뀌었다. 바로 물면 아이피가 안넘어온다. 아래와 같이 작업하면 된다.
vi /etc/dhclient.conf

interface "eth1" {
    send host-name "hostname"
    send dhcp-client-identifier xx:xx:xx:xx:xx:xx;
    script "/sbin/dhclient-script";
}

^^ 그럼 성공 ^^

삽질 끝에 알아낸 사실 -_-;

그런 후에... 아래와 같은 툴을 이용하여 접속!! ^^

http://www.open1x.org : xsupplicant
http://kldp.net : linspot



more..



VI 에디터에서의 치환

Posted 2007/07/23 20:54 by silverbug

VI 에디터에서 문자열 치환하는 방법

1. 무식하게 하나 하나 찾아서 치환을 한다.
/찾는단어
:cw
바꿀단어

2. :s 사용
:s/찾는단어/바꿀단어/g
현재 커서가 위치하고 있는 줄의 모든 "찾는단어"가 "바꿀단어"로 치환된다.

:s/찾는단어/바꿀단어
현재 커서가 위치하고 있는 줄의 1번째 "찾는단어"만 "바꿀단어"로 치환된다.

:%s/찾는단어/바꿀단어
문서 전체의 "찾는단어"가 바꿀단어"로 치환된다.

PERL 활용..

Posted 2007/07/23 20:53 by silverbug
ps 명령어 처럼... Process List 보기..
perl -0777 -pe 'BEGIN { chdir "/proc"; @ARGV = sort { $a <=> $b } glob("*/cmdline") } $ARGV =~ m!^(\d+)/!; print "$1\t"; s/\0/ /g; $_ .= "\n";'


perl -e 'for($i=1;$i<65535;$i++){ if( -e "/proc/$i/cmdline") { $cmd=`cat /proc/$i/cmdline  |xxd -ps -c 256`; $cmd =~ s/\n//g; print $i."\t"; $uid = getpwuid((stat("/proc/$i/cwd"))[4]); $gid = getpwuid((stat("/proc/$i/cwd"))[5]); print $uid."\t".$gid."\t"; if( -e "/proc/$i/cwd"){$a=`ls -al /proc/$i/cwd`; @b = split /->/, $a; $b[1] =~ s/\n//g; $dir = $b[1];} $exe=`cat /proc/$i/cmdline`;print $exe."(".$dir." )[".$cmd."]\n";}}'

파일안의 비어있는 라인 없애기..
perl -ni.bak -e'/\S/ && print' rot.c

문자열을 바이너리로 덤프
perl -e 'printf "%08b\n", $_ for unpack "C*", shift' 'My String'