Postgresql注入研究三两事(续集)
以下下部分有Mickey兄提供
1.在postgresql下导出webshell
PGADMIN 的帐户信息,在linux 下默认存放在用户家目录的.pgpass 文件中 我的小小补充 没研究注入许久了,多谢Mickey兄提供才有了我重新审视pgsql注入的机会。 从pgsql8.2开始支持adminpack这个包,看了代码过后认为几乎对于管理员来说,可以无限制使用。(代码 https://projects.commandprompt.com/public/replicator/browser/trunk /contrib/adminpack/adminpack.c)。权限要求很高。主要有这几个函数 pg_file_write(filename,text,bool) bool为覆盖模式 pg_read_file(filename,pos,length) 返回类型text不提,很好利用,不管是cast暴值还是union pg_ls_dir(dirname) 注意他的返回类型为setof text 需要这样来(select pg_ls_dir('/var/www/') limit 1 offset n)这样来读取不同记录 pg_stat_file(filename) 这个返回结果是record,为文件属性,需要把他作为一个子表来看待。不太清楚具体的返回字段。有兴趣的同学自己看看。另外像pg_file_unlink,pg_file_raname不提。 单引号的绕过在pg8.0以上容易实现。这部分来源于老外的文档。大致意思可以用$quote$代替单引号,也可以用$$来定义字符。比如'test'变成$quote$test$quote$或$$test$$。这样对php的注入就大为方便了。 下面引用自:Advanced PostgreSQL SQL Injection and Filter Bypass Techniques(作者:Leon Jurani?) This allows the attacker string quoting with the dollar sign; the following two strings are treated identically by a PostgreSQL database version 8 or higher: 'TEST' and $$TEST$$. Considering that magic quotes does not filter dollar signs,this allows the attacker to inject strings into SQL statements without the need to use the CHR() function. Such encoding of strings can also be used with web application firewalls that filter other characters,such as the pipe ('|') character. The following example shows a SELECT statement using a dollar-quoted string constant: SELECT $$DOLLAR-SIGN-TEST$$; Finally,PostgreSQL supports string quoting with tags. Tags have to be defined between the dollar signs ($tag$),as shown in the example below: SELECT $quote$DOLLAR-SIGN-TEST$quote$; This can further help the attacker bypass web application firewalls. 附录: 系统信息函数 表 9-39 显示了几个抽取会话及系统信息的函数。
session_user 通常是初始化当前数据库联接的用户, 不过超级用户可以用 SET SESSION AUTHORIZATION 修改这个设置。 current_user 是用于权限检查的用户标识。通常, 它总是等于会话用户,但是在将来可能有 "setuid" 函数和其他它是等于会话用户, 但是它在函数执行的过程中随着属性 SECURITY DEFINER 的改变而改变。 在 Unix 的说法里,那么会话用户是 " 真实用户 " ,而当前用户是 " 有效用户 " 。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- cocos2dx[3.2](11)——新回调函数std::bind
- MapAbc Ajax API(Flash地图展现)V2.4
- VC实现给窗体的一个按钮添加事件的方法
- Swift3.0之hidesBottomBarWhenPushed的使用和注意事项
- cocos2d-x 模型用上shader的方法。仅备份
- cc.ScrolView在cocos2d-js中未定义
- c – std :: pair期待’type’,但我给它一个类型
- c – 在iPhone上获取蓝牙MAC地址
- flex air 设置应用程序图标 - [Desktop - AIR]
- objective-c – 如何构建一个在iOS上具有最大兼容性的静态库