<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Kommentare zu: Create Table  &#8220;!rm -Rf /&#8221; (&#8221;&#8216; or 1=1&#8211;&#8221; a varchar2(1));</title>
	<link>http://blog.red-database-security.com/2007/09/12/create-table-rm-rf-or-11-a-varchar21/</link>
	<description></description>
	<pubDate>Sat, 22 Nov 2008 03:27:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>Von: Marco Gralike</title>
		<link>http://blog.red-database-security.com/2007/09/12/create-table-rm-rf-or-11-a-varchar21/#comment-1016</link>
		<author>Marco Gralike</author>
		<pubDate>Fri, 14 Sep 2007 07:40:23 +0000</pubDate>
		<guid>http://blog.red-database-security.com/2007/09/12/create-table-rm-rf-or-11-a-varchar21/#comment-1016</guid>
		<description>In other words, Sven, don't forget to use the double quotes...</description>
		<content:encoded><![CDATA[<p>In other words, Sven, don&#8217;t forget to use the double quotes&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: Marco Gralike</title>
		<link>http://blog.red-database-security.com/2007/09/12/create-table-rm-rf-or-11-a-varchar21/#comment-1015</link>
		<author>Marco Gralike</author>
		<pubDate>Fri, 14 Sep 2007 07:38:21 +0000</pubDate>
		<guid>http://blog.red-database-security.com/2007/09/12/create-table-rm-rf-or-11-a-varchar21/#comment-1015</guid>
		<description>SQL&#62; conn system/oracle
Connected.
SQL&#62; create table "!rm -Rf /tmp/somestuff/" (a varchar2(1));

Table created.

SQL&#62; drop table "!rm -Rf /tmp/somestuff/";

Table dropped.

SQL&#62; create table "!rm -Rf /tmp/somestuff/" (a varchar2(1));

Table created.

SQL&#62; create synonym "DUAL" for "!rm -Rf /tmp/somestuff/";

Synonym created.

SQL&#62; desc dual
 Name         Null?    Type
 ------------ -------- -------------
 A                     VARCHAR2(1)


SQL&#62; select * from dual;

no rows selected

SQL&#62; drop synonym "DUAL";

Synonym dropped.

SQL&#62; desc dual
 Name         Null?    Type
 ------------ -------- -----------------------------------------
 DUMMY                 VARCHAR2(1)

SQL&#62;  create synonym "DUAL" for "!rm -Rf /tmp/somestuff/";

Synonym created.

SQL&#62; select * from dual;

no rows selected

SQL&#62; create or replace force view EMP
  2  as
  3  select * from "DUAL" ;

View created.

SQL&#62; desc EMP
 Name         Null?    Type
 ------------ -------- -----------------------------------------
 A                     VARCHAR2(1)

SQL&#62; create or replace force view DEPT
  2  as
  3  select * from "!rm -Rf /tmp/somestuff/";

View created.

SQL&#62; create or replace force view DEPT
  2  as
  3  select * from "!rm -Rf /tmp/somestuff/";

View created.

SQL&#62; desc DEPT
 Name         Null?    Type
 ------------ -------- -----------------------------------------
 A                     VARCHAR2(1)

SQL&#62; select 'drop table "'&#124;&#124;table_name&#124;&#124;'"  cascade constraints; ' from user_tables;

'DROPTABLE"'&#124;&#124;TABLE_NAME&#124;&#124;'"CASCADECONSTRAINTS;'
--------------------------------------------------------------------------------
drop table "LOGMNR_PARAMETER$"  cascade constraints;
drop table "LOGMNR_SESSION$"  cascade constraints;
drop table "MVIEW$_ADV_WORKLOAD"  cascade constraints;
drop table "MVIEW$_ADV_BASETABLE"  cascade constraints;

.....

drop table "!rm -Rf /tmp/somestuff/"  cascade constraints;

.....

drop table "LOGMNR_GLOBAL$"  cascade constraints;
drop table "LOGMNR_SESSION_EVOLVE$"  cascade constraints;
drop table "LOGMNR_UID$"  cascade constraints;

154 rows selected.

SQL&#62; drop view emp;

View dropped.

SQL&#62; drop view dept;

View dropped.

SQL&#62; drop synonym dual;

Synonym dropped.

SQL&#62; drop table "!rm -Rf /tmp/somestuff/";

Table dropped.</description>
		<content:encoded><![CDATA[<p>SQL&gt; conn system/oracle<br />
Connected.<br />
SQL&gt; create table &#8220;!rm -Rf /tmp/somestuff/&#8221; (a varchar2(1));</p>
<p>Table created.</p>
<p>SQL&gt; drop table &#8220;!rm -Rf /tmp/somestuff/&#8221;;</p>
<p>Table dropped.</p>
<p>SQL&gt; create table &#8220;!rm -Rf /tmp/somestuff/&#8221; (a varchar2(1));</p>
<p>Table created.</p>
<p>SQL&gt; create synonym &#8220;DUAL&#8221; for &#8220;!rm -Rf /tmp/somestuff/&#8221;;</p>
<p>Synonym created.</p>
<p>SQL&gt; desc dual<br />
 Name         Null?    Type<br />
 &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
 A                     VARCHAR2(1)</p>
<p>SQL&gt; select * from dual;</p>
<p>no rows selected</p>
<p>SQL&gt; drop synonym &#8220;DUAL&#8221;;</p>
<p>Synonym dropped.</p>
<p>SQL&gt; desc dual<br />
 Name         Null?    Type<br />
 &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
 DUMMY                 VARCHAR2(1)</p>
<p>SQL&gt;  create synonym &#8220;DUAL&#8221; for &#8220;!rm -Rf /tmp/somestuff/&#8221;;</p>
<p>Synonym created.</p>
<p>SQL&gt; select * from dual;</p>
<p>no rows selected</p>
<p>SQL&gt; create or replace force view EMP<br />
  2  as<br />
  3  select * from &#8220;DUAL&#8221; ;</p>
<p>View created.</p>
<p>SQL&gt; desc EMP<br />
 Name         Null?    Type<br />
 &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
 A                     VARCHAR2(1)</p>
<p>SQL&gt; create or replace force view DEPT<br />
  2  as<br />
  3  select * from &#8220;!rm -Rf /tmp/somestuff/&#8221;;</p>
<p>View created.</p>
<p>SQL&gt; create or replace force view DEPT<br />
  2  as<br />
  3  select * from &#8220;!rm -Rf /tmp/somestuff/&#8221;;</p>
<p>View created.</p>
<p>SQL&gt; desc DEPT<br />
 Name         Null?    Type<br />
 &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
 A                     VARCHAR2(1)</p>
<p>SQL&gt; select &#8216;drop table &#8220;&#8216;||table_name||&#8217;&#8221;  cascade constraints; &#8216; from user_tables;</p>
<p>&#8216;DROPTABLE&#8221;&#8216;||TABLE_NAME||&#8217;&#8221;CASCADECONSTRAINTS;&#8217;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
drop table &#8220;LOGMNR_PARAMETER$&#8221;  cascade constraints;<br />
drop table &#8220;LOGMNR_SESSION$&#8221;  cascade constraints;<br />
drop table &#8220;MVIEW$_ADV_WORKLOAD&#8221;  cascade constraints;<br />
drop table &#8220;MVIEW$_ADV_BASETABLE&#8221;  cascade constraints;</p>
<p>&#8230;..</p>
<p>drop table &#8220;!rm -Rf /tmp/somestuff/&#8221;  cascade constraints;</p>
<p>&#8230;..</p>
<p>drop table &#8220;LOGMNR_GLOBAL$&#8221;  cascade constraints;<br />
drop table &#8220;LOGMNR_SESSION_EVOLVE$&#8221;  cascade constraints;<br />
drop table &#8220;LOGMNR_UID$&#8221;  cascade constraints;</p>
<p>154 rows selected.</p>
<p>SQL&gt; drop view emp;</p>
<p>View dropped.</p>
<p>SQL&gt; drop view dept;</p>
<p>View dropped.</p>
<p>SQL&gt; drop synonym dual;</p>
<p>Synonym dropped.</p>
<p>SQL&gt; drop table &#8220;!rm -Rf /tmp/somestuff/&#8221;;</p>
<p>Table dropped.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: Sven Vetter</title>
		<link>http://blog.red-database-security.com/2007/09/12/create-table-rm-rf-or-11-a-varchar21/#comment-1012</link>
		<author>Sven Vetter</author>
		<pubDate>Fri, 14 Sep 2007 05:52:56 +0000</pubDate>
		<guid>http://blog.red-database-security.com/2007/09/12/create-table-rm-rf-or-11-a-varchar21/#comment-1012</guid>
		<description>Hallo

Habe das mal etwas durchgetestet. Sie haben recht, je nach Situation kann mit diesen Tabellennamen etwas passieren. Aber nicht in jedem Ihrer Beispiele.

drop table !rm -Rf / cascade constraints;
erzeugt z.B. einen Syntaxfehler, da ! das erste Zeichnen sein muss, damit ein Hostkommando ausgeführt wird.

Genauso werden in den anderen Fällen (ausser sys.aud$) keine Aktionen ausgeführt. 

Trotzdem - klar dürfen keine solche Tabellennamen vorkommen - je nach Kontext kann etwas falsches/gefährliches rauskommen.

Tipp:
Ich schreibe Ihr Besispiellösch-Script nie so, wie sie es haben, da ich doch einige Applikationen mit Case-Sensitiven Tabellennamen kenne.

Deswegen etwas besser und etwas sicherer:
select 'drop table "'&#124;&#124;table_name&#124;&#124;'" cascade constraints ;" from dba_tables where owner="RDS";
Also Tabellennamen in Doublequotes. Dann wird auch die "richtige" sys.aud$ gelöscht.

Viele Grüsse
 Sven</description>
		<content:encoded><![CDATA[<p>Hallo</p>
<p>Habe das mal etwas durchgetestet. Sie haben recht, je nach Situation kann mit diesen Tabellennamen etwas passieren. Aber nicht in jedem Ihrer Beispiele.</p>
<p>drop table !rm -Rf / cascade constraints;<br />
erzeugt z.B. einen Syntaxfehler, da ! das erste Zeichnen sein muss, damit ein Hostkommando ausgeführt wird.</p>
<p>Genauso werden in den anderen Fällen (ausser sys.aud$) keine Aktionen ausgeführt. </p>
<p>Trotzdem - klar dürfen keine solche Tabellennamen vorkommen - je nach Kontext kann etwas falsches/gefährliches rauskommen.</p>
<p>Tipp:<br />
Ich schreibe Ihr Besispiellösch-Script nie so, wie sie es haben, da ich doch einige Applikationen mit Case-Sensitiven Tabellennamen kenne.</p>
<p>Deswegen etwas besser und etwas sicherer:<br />
select &#8216;drop table &#8220;&#8216;||table_name||&#8217;&#8221; cascade constraints ;&#8221; from dba_tables where owner=&#8221;RDS&#8221;;<br />
Also Tabellennamen in Doublequotes. Dann wird auch die &#8220;richtige&#8221; sys.aud$ gelöscht.</p>
<p>Viele Grüsse<br />
 Sven</p>
]]></content:encoded>
	</item>
</channel>
</rss>
