THM – Network Services – SMB – Part 3

Last Updated on January 25, 2022 by aghanim

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

  • Active Directory – Notes, Methodology, Cheatsheet

    Last Updated on October 17, 2025 by aghanim These are my notes from the Active Directory networks at TryHackMe, as well as notes from other sources. Inspo: Work in progress Table Of ContentsReferences MatrixLOLBAS – Living off the landWADComs – Very useful cheatsheetIcebreakerAD MethodologyMindmap – Current 2025Mindmap – Nr 2Mindmap – Nr 3Active Directory TheoryObject…

  • THM – Upload Vulnerabilities – Part 13

    Last Updated on March 24, 2022 by aghanim 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 ContentsIntroductionMethodology – EnumerationOverwriting Existing FilesRemote Code ExecutionFilteringClient-side filteringServer-side filteringExtension ValidationFile Type FilteringFile Length…

  • Handbook V – Maldev

    Last Updated on October 16, 2025 by aghanim Work in Progress Table Of ContentsCoursesSourcesx86 & x64 Assembler and DisassemblerCallback function listExample: Using  ​CertEnumSystemStore​ Convert raw shellcode to raw binary formatEDR TelematryEDR Telematry v2Entropy reductionHijackLibsJoesandbox – Malware AnalysisMalapi.ioNo-defenderNtDoc – The native NT API online documentationParasite-invokeReverse engineering of everything MicrosoftVergilius projectUnprotect.itEvasion techniquesWindows Icons Courses SEKTOR7 Institute https://maldevacademy.com/ EvasionEDR…

  • THM – Authentication Bypass – Part 6

    Last Updated on January 25, 2022 by aghanim 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 ContentsUsername EnumerationBrute ForceLogical FlawWhat is a Logical Flaw?Logical Flaw ExampleLogic Flaw PracticalCookie TamperingPlain TextHashingEncoding Username Enumeration A helpful exercise to…

  • AV Evasion 101: Essential Techniques and Concepts

    Last Updated on December 11, 2023 by aghanim 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…

  • THM – NMAP Documentation and Commands – Part 13

    Last Updated on January 25, 2022 by aghanim 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 ContentsNMAP Live Host DiscoveryNMAP Basic Port ScansTCP FlagsTimingsSummaryNMAP Advanced Port ScansNMAP Post Port Scans NMAP Live Host Discovery Scan Type…