Tuesday, July 13, 2010

Identified Ubuntu version from SSH banner

Many times seeing the SSH full banner, I have to googling it for the OS version. I decided I should collect them here.

Let me note a little knowledge about banner (identification string in RFC).

Following RFC 4253 (section 4.2. Protocol Version Exchange), after connection established, the client and server MUST send an identification string. The identification string MUST be

SSH-protoversion-softwareversion SP comments CR LF

The 'comments' string is OPTIONAL. Below are example of valid identification string:
- SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1
- SSH-2.0-PuTTY_Release_0.60

To make it easy, I call the identification string as "banner". From the example banners, they are very easy to guess the product name and version. The banner can be for more useful.

As told in title, the default banner can be used for identified Linux distribution and version. For example, the banner "SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1" is identified as Ubuntu 9.04. However, of course, it's work only if administrator installs the binary package from its own distribution.

Before going to a list of SSH banner and OS version, I want to say it again "the client and server MUST send an identification string". It means you can identify OS of client and server.

Here is the list that I checked
Ubuntu 5.10:  SSH-2.0-OpenSSH_4.1p1 Debian-7ubuntu4
Ubuntu 6.04:  SSH-2.0-OpenSSH_4.2p1 Debian-7ubuntu3[.x]
Ubuntu 7.04:  SSH-2.0-OpenSSH_4.3p2 Debian-8ubuntu1[.x]
Ubuntu 7.10:  SSH-2.0-OpenSSH_4.6p1 Debian-5ubuntu0[.x]
Ubuntu 8.04:  SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1[.x]
Ubuntu 8.10:  SSH-2.0-OpenSSH_5.1p1 Debian-3ubuntu1
Ubuntu 9.04:  SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1
Ubuntu 9.10:  SSH-2.0-OpenSSH_5.1p1 Debian-6ubuntu2
Ubuntu 10.04: SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu3
Ubuntu 10.04.1: SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu4
Ubuntu 10.04.2: SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu{5,6}
Ubuntu 10.04.3: SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu7
Ubuntu 10.10: SSH-2.0-OpenSSH_5.5p1 Debian-4ubuntu{4,5}
Ubuntu 11.04: SSH-2.0-OpenSSH_5.8p1 Debian-1ubuntu3
Ubuntu 11.10: SSH-2.0-OpenSSH_5.8p1 Debian-7ubuntu1

Why only Ubuntu?
Because I know Ubuntu upgrade OpenSSH only when they release a new version. I do not know other distributions.

But I also list other default banners :)
Debian 4:  SSH-2.0-OpenSSH_4.3p2 Debian-9
Debian 5:  SSH-2.0-OpenSSH_5.1p1 Debian-5
Debian 6:  SSH-2.0-OpenSSH_5.5p1 Debian-6

FreeBSD 7.0:  SSH-2.0-OpenSSH_4.5p1 FreeBSD-20061110
FreeBSD 7.2:  SSH-2.0-OpenSSH_5.1p1 FreeBSD-20080901
FreeBSD 8.0:  SSH-2.0-OpenSSH_5.2p1 FreeBSD-20090522
FreeBSD 8.1:  SSH-2.0-OpenSSH_5.4p1 FreeBSD-20100308
FreeBSD 9.0:  SSH-2.0-OpenSSH_5.8p2_hpn13v11 FreeBSD-20110503

openSUSE 10.0: SSH-2.0-OpenSSH_5.0
openSUSE 10.1: SSH-2.0-OpenSSH_5.1
openSUSE 10.2: SSH-2.0-OpenSSH_5.2

CentOS 4.x:  SSH-2.0-OpenSSH_3.9
CentOS 5.x:  SSH-2.0-OpenSSH_4.3
CentOS 6.x:  SSH-2.0-OpenSSH_5.3

Fedora 12:  SSH-2.0-OpenSSH_5.2
Fedora 13:  SSH-2.0-OpenSSH_5.4
Fedora 14:  SSH-2.0-OpenSSH_5.5
Fedora 15:  SSH-2.0-OpenSSH_5.6
Fedora 16:  SSH-2.0-OpenSSH_5.8
It seems the distributions that derived from RedHat show only OpenSSH version and no "pX" after version.

Friday, July 9, 2010

Bruter 1.1 beta1 is out

I'm back. Bruter 1.0 final was released about 2 months ago.

Today, I just want to say 1.1 beta1 is out. Download it from http://sourceforge.net/projects/worawita/.

If anyone want to see the awesome change (I hope) from new version, try SMB service. :D

Sunday, December 30, 2007

VNC anti brute force algorithm

ในที่สุดก็ได้ update blog ฉลองปีใหม่ ก่อนอื่นก็ต้อง Happy New Year :D

ตอนนี้กำลังเขียน module ทำ brute force ตัว VNC ของ Bruter อยู่ ตอนที่กำลังหาทดสอบอยู่ ก็พบกับความประหลาดใจ เนื่องจากเป็น protocol แรก ที่เจอระบบ anti brute force ที่ไม่ใช่การ lock out user

ก่อนเริ่มอธิบาย ต้องบอกก่อนว่าตัว VNC server ที่ทดสอบก็มี RealVNC, UltraVNC และ TightVNC โดย RealVNC จะแบ่ง version เป็น 3.x กับ 4.x ซึ่ง 2 version นี้จะมีระบบ anti brute force ต่างกันนิดหน่อย และตัว UltraVNC กับ TightVNC จะใช้ระบบเดียวกันกับ RealVNC 3.x

RealVNC 3.x anti brute force algorithm
if (strcmp(current->_machineName, machine) == 0) {
// If the host is already blocked then ignore
if (current->_blocked)
return;

// Set the RefTime & failureCount
current->_lastRefTime.QuadPart = now.QuadPart + 10;
current->_failureCount++;

if (current->_failureCount > 5)
current->_blocked = TRUE;
return;
}
source code จากไฟล์ winvnc/vncserver.cpp, function: AddAuthHostsBlacklist()

ตัว VNC server จะยอมให้มีการ login ผิดได้ 5 ครั้งจาก IP เดียวกัน หลังจากนั้นผิดครั้งหนึ่งจะ block 10 วินาที ตัว VNC server จะเริ่มนับ 0 ใหม่เมื่อมีการ login ถูกจาก IP ที่เป็น blacklist เท่านั้น

RealVNC 4.x anti brute force algorithm
if ((*i).second.marks >= threshold) {
// Yes - entry is blocked - has the timeout expired?
time_t now = time(0);
if (now >= (*i).second.blockUntil) {
// Timeout has expired. Reset timeout and allow
// a re-try.
(*i).second.blockUntil = now + (*i).second.blockTimeout;
(*i).second.blockTimeout = (*i).second.blockTimeout * 2;
return false;
}
// Blocked and timeout still in effect - reject!
return true;
}

// We haven't reached the threshold yet.
// Increment the black-mark counter but allow
// the entry to pass.
(*i).second.marks++;
return false;
โดยมีตัวแปร threshold เป็น 5 และ initialTimeout เป็น 10
source code จากไฟล์ rfb/BlackList.cxx

อธิบายง่ายๆ ก็คือเหมือนกับ RealVNC 3.x แต่จะ block นานขึ้นสองเท่าจากของเดิมเรื่อยๆ คือครั้งแรก 10 วินาที ครั้งที่สอง 20 วินาที ครั้งที่สาม 40 วินาที ไปเรื่อยๆ

Wednesday, December 5, 2007

SMTP LOGIN command

ที่เคย note เอาไว้นานแล้ว เรื่อง SMTP command หาดูได้ Labal เดียวกัน

ครั้งที่แล้วเขียนวิธี authen ไว้แค่แบบเดียวคือ แบบ PLAIN ซึ่งตอนที่เขียนโปรแกรม Bruter ก็พบว่า ถ้าเป็น SMTP server ของ Microsoft นั้นจะไม่มีแบบ PLAIN จะมีเฉพาะ LOGIN method

ก็มา note เพิ่มละกัน เกี่ยวกับ LOGIN method

ก่อนอื่นเราต้องทำ base64 encoding เหมือนกัน แต่คราวนี้ทำแยก username กับ password
ทำ username
base64.encodestring('user@domain.ext') เป็น dXNlckBkb21haW4uZXh0
base64.encodestring('password') เป็น cGFzc3dvcmQ=

เริ่ม authen
AUTH LOGIN
334 VXNlcm5hbWU6
dXNlckBkb21haW4uZXh0
334 UGFzc3dvcmQ6
cGFzc3dvcmQ=
235 2.0.0 OK Authenticated

ถ้าเอาที่อ่านไม่ออกทั้งหมดมาทำ decoding ด้วย base64 ก็จะเป็น
AUTH LOGIN
334 Username:
user@domain.ext
334 Password:
password
235 2.0.0 OK Authenticated

และก็จริงๆ แล้วสามารถส่ง username ได้ตั้งแต่บรรทัดแรกก็จะเป็นแบบนี้
AUTH LOGIN dXNlckBkb21haW4uZXh0
334 UGFzc3dvcmQ6
cGFzc3dvcmQ=
235 2.0.0 OK Authenticated

แต่ยังไงก็ต้องอย่าลืมดู response ถ้ามัน response กลับมาให้ใส่ username ก็ต้องส่ง username

Thursday, November 22, 2007

Bruter 1.0 beta1 released

ออกแล้วนะ version beta1 หลักๆ ก็คือแก้โค้ดข้างใน, bug และก็เพิ่ม MSSQL, MySQL, SNMP

โหลดกันได้ที่
http://sourceforge.net/project/platformdownload.php?group_id=204020

Sunday, October 21, 2007

Bruter 1.0 alpha2 release

ในที่สุดก็ได้ release โปรแกรมนี้อีกรอบ แต่ยังคงเป็น alpha version

ดู changelog เอาเองละกัน หาโหลดได้ที่เดิม http://sourceforge.net/projects/worawita/

ปล. เนื่องด้วยก่อนหน้านี้เอาแต่เล่น hackthissite ทำให้หายไปนาน และออก alpha2 ช้า

Thursday, September 20, 2007

Bruter 1.0 alpha1 release

ออกแล้ว โปรแกรม Bruter - parallel login brute forcer version 1.0 alpha1

=======================
Version 1.0 alpha1
=======================

- Initial alpha release
- Support protocols: FTP, HTTP (Basic), HTTP (Form), IMAP, POP3, SMB, SMTP, Telnet
- Support SSL

หาโหลดได้ที่ http://sourceforge.net/projects/worawita/