The Oracle exploit (Exploit
1) is functionally similar to the PostgreSQL version. The differences are
explained below.
The main difference with the PostgreSQL version is
the fact that iSQL*Plus is particular about the linebreaks
in the code. To handle this, the queries are extended to
copy the linebreaks; CHR(10) is a function
that returns the newline character.
In the UPDATE statement, code to create the temporary
function is written to the NewContents field.
The body of the function is created using the function that
is created in the second line, like it is in the PostgreSQL
query. In this case, however, the function returns a string
containing newlines. This string is processed using the
replace function to replace the newlines in
with ' || CHR(10) || '. This ensures that the
code that is written to the database is an exact copy of
the currently running query.
Finally, Oracle doesn't provide PostgreSQL's
quote_literal function. The
replace function is used instead. PostgreSQL's
quote_literal function encloses the string in
quotes, but replace does not. Therefore, the
call to trim is not needed.
|