THM – Network Services – SMB – Part 3

Understanding SMB 

SMB – Server Message Block Protocol – is a client-server communication protocol used for sharing access to files, printers, serial ports and other resources on a network.  

Servers make file systems and other resources available to clients on the network. Client computers may have their own hard disks, but they also want access to the shared file systems and printers on the servers.  

The SMB protocol is known as a response-request protocol, meaning that it transmits multiple messages between the client and server to establish a connection. Clients connect to servers using TCP/IP, NetBEUI or IPX/SPX.  

How does SMB work?  

Once they have established a connection, clients can then send commands (SMBs) to the server that allow them to access shares, open files, read and write files, and generally do all the sort of things that you want to do with a file system. With SMB, this is done over the network. 

What runs SMB? 

Microsoft Windows operating system since windows 95 have included client and server SMB protocol support. Samba, an open source server that supports the SMB protocol, was released for UNIX systems.  

QuestionsAnswers
What type of protocol is SMB? 
Response-request 
What do clients connect to server using? TCP/IP 

Enumerating SMB 

What is enumerations?

Enumerations is the process of gathering information on a target in order to find potential attack vectors and aid in exploitation.  

The first step of enumeration is to conduct a port scan. Find out as much info as you can about the services, applications, structure and operating system of the target machine.  

Enum4linux is a tool used to enumerate SMB shares on both Windows and Linux systems. Makes it easy to quickly extract information from the target pertaining to SMB.  

The syntax for enum4linux: 

enum4linux [options] ip 
TAG FUNCTION 
-U Get userlist 
-M Get machine list 
-N Get namelist dump 
-S Get sharelist 
-P Get password policy info 
-G Get group and member list 
-A All of the above 

Conduct a full basic enumeration with enum4linux.  

Enum4linux –A 10.10.182.32 

What is the workgroup name? 

What operating system version is running? 

What comes up as the name of the machine? 

What share sticks out as something we might want to investigate? 

PROFILES 

Exploiting SMB 

More likely to encounter a situation where the best way into a system is due to misconfigurations in the system. In this case we’re going to be exploiting anonymous SMB share access- a common misconfiguration that can allow us to gain information that will lead to. Shell.  

From our enumeration state we know: 

  • The SMB share location 
  • The name of an interesting SMB share 

SMB client 

When trying to access SMB share, we need a client. Will be using SMBClient because its default samba suit. When trying to access SMB share, we need a client. Will be using SMBClient because its default samba suit.

Remotely access the SMB share using the syntax:  

smbclient //IP/Share 

Followed by the tags:  

-U name: to specify the user 

-p port: to specify the port 

What would be the correct syntax to access an SMB share called “secret” as user “suit” on a machine with IP 10.10.10.2 on the default port? 

smbclient //10.10.10.2/secret -U suit -p 445 

Now let’s have a look at trying to exploit this vulnerability. We have the list of users, the name of the share and suspected vulnerability.

Look for any interesting documents that could contain valuable information. Who does this profile belong to? 

John Cactus 

What services has been configured to allow him to work from home? 

.ssh 

The directory contains authentication keys that allow a user to authenticate themselves on, the access a server. Which keys is the most useful to us?  

Id_rsa. Private key for ssh.  

Download the file to local machine, change the permission to 600 using 

chmod 600 file

Use the service and key to log-in to the server and find the flag!

Similar Posts

  • AV Evasion 101: Essential Techniques and Concepts

    Table Of ContentsSourceGood toolsMalware forums/channels/discordTest payload against AVDefcon – Writing custom backdoor payloads with C#Step by Step for obfuscating codeAV Evasion MindMap – From Start to finishGeneral AV Evasion cheatsheetCheck AV – Running, Exclusion, DisableWindows FirewallPowershell – ASMI bypass methods, Disable AV, etcAMSI BypassBypass CLM (Constrained Language Mode)Bypass loggingDisable MS Defender (Require elevation)Add folder exclusionLSASS…

  • THM – IDOR – Part 7

    This is my notes from the Junior Pentesting course at TryHackMe. This course takes you through the basics and some advanced topics regarding penetration testing. Table Of ContentsWhat is an IDOR?An IDOR ExampleFinding IDORs in Encoded IDsEncoded IDsFinding IDORs and Hashed IDsHashed IDsFinding IDORs in Unpredictable IDsUnpredictable IDsWhere are IDORs locatedWhere are they located?A Practical IDOR ExampleWhat…

  • THM – How Websites Work – Part 9

    Table Of ContentsHow websites work HTML JavaScript Sensitive Data Exposure HTML Injection  How websites work  When you visit a website, your browser makes a request to a web server asking for information about the page you’re visiting and will respond with data that your browser uses to show you the page; a web server is just a dedicated computer that handles your requests.  …

  • THM – Windows Exploitation Basics – Part 17

    This is a continued series where I document my path through different tryhackme courses. I recommend everyone that wants to learn cyber security to subscribe to tryhackme.com and take the courses there. Table Of ContentsWindows file system and permissions explainedUnderstanding the authentication process Windows file system and permissions explained What is the file system? It…

  • THM – Intro to pentesting – Fundamentals – Part 1

    This is my notes from the Junior Pentesting course at TryHackMe. This course takes you through the basics and some advanced topics regarding penetration testing. Table Of ContentsPenetration testing ethicsRules of Engagement (ROE)Penetration Testing MethodoligiesOSSTMMOWASPNIST Cybersecurity Framework 1.1NCSC CAFBlack box, White box, Grey box penetration testingBlack-Box testingGrey-box testingWhite-Box Testing Penetration testing ethics Hat Category Description…

  • THM – Web Fundamentals – Part 10

    Table Of ContentsHow Do We Load Websites?  More HTTPS – Verbs and request formats Cookies  How Do We Load Websites?   Finding the server  A DNS request is made initially. DNS is like a giant phone book that takes a URL and turns it into an IP. You dont have to remember the IP of websites.   The IP address uniquely identifies each internet connected devices, like a web servere or your computer. They are formed of 4 groups of number, each 0-255 (x.x.x.x) and called an octect. Loading some content …