<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/16826" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2009-04-20T22:11:28-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/16826</id>

		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2009-04-20T22:11:28-04:00</updated>

		<published>2009-04-20T22:11:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88523#p88523</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88523#p88523"/>
		<title type="html"><![CDATA[dccsend with arguments security issue [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88523#p88523"><![CDATA[
definately ^^<br>&lt;3 tcl <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Mon Apr 20, 2009 10:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dmg]]></name></author>
		<updated>2009-04-20T22:07:43-04:00</updated>

		<published>2009-04-20T22:07:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88522#p88522</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88522#p88522"/>
		<title type="html"><![CDATA[dccsend with arguments security issue [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88522#p88522"><![CDATA[
Thank you very much for your help. The first example worked just fine! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Isn't that the beauty with scripting and programming that you're almost never limited to a single way to solve things <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10612">dmg</a> — Mon Apr 20, 2009 10:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2009-04-20T22:00:43-04:00</updated>

		<published>2009-04-20T22:00:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88521#p88521</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88521#p88521"/>
		<title type="html"><![CDATA[dccsend with arguments security issue [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88521#p88521"><![CDATA[
<blockquote class="uncited"><div>03:54 &lt;@dMG&gt; !get ../../../../etc/passwd<br>03:54 &lt;@hosee2&gt; requesting transfer of ../../../../etc/passwd to dMG<br>03:54 &lt;@hosee2&gt; ok! sending file<br>03:54 &lt;@hosee2&gt; ---==(\/)- getdiz by dmg -(\/)==--- </div></blockquote>woah lol<br>yup thats really a nice one <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>try the possible solution i gave you, should work out fine, if not try<br><div class="codebox"><p>Code: </p><pre><code>if { [string equal -nocase "*../*" $arg] } {   putlog "wrong path"    return 0}</code></pre></div>theres always more than one way to solve something <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Mon Apr 20, 2009 10:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dmg]]></name></author>
		<updated>2009-04-20T21:56:04-04:00</updated>

		<published>2009-04-20T21:56:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88520#p88520</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88520#p88520"/>
		<title type="html"><![CDATA[dccsend with arguments security issue [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88520#p88520"><![CDATA[
yea <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>Any user with access to the !get command and a known filename could use it like this f.i.:<br><br>03:54 &lt;@dMG&gt; !get ../../../../etc/passwd<br>03:54 &lt;@hosee2&gt; requesting transfer of ../../../../etc/passwd to dMG<br>03:54 &lt;@hosee2&gt; ok! sending file<br>03:54 &lt;@hosee2&gt; ---==(\/)- getdiz by dmg -(\/)==---<br><br>so they don't seem to be jailed to the $rootdir (as i too thought first).<br><br>edit:<br><br>thx! i'll try playing around with that! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10612">dmg</a> — Mon Apr 20, 2009 9:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2009-04-20T21:49:09-04:00</updated>

		<published>2009-04-20T21:49:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88519#p88519</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88519#p88519"/>
		<title type="html"><![CDATA[dccsend with arguments security issue [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88519#p88519"><![CDATA[
maybe i didnt quite understand what you want to do, but what i understood until now is that you want users ONLY have access to $rootdir and below but nowhere else than $rootdir and below?<br><br>if thats the case i dont see anything wrong because $rootdir is "hardcoded" and since you are using $arg as an addition to $rootdir your users will get "jailed" into $rootdir anyway.<br><br>correct me if i got something wrong <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>edit:<br><br>what you COULD do to limit ../../ is to add:<br><div class="codebox"><p>Code: </p><pre><code>if { [regexp -all -nocase -- {\.\./} $arg] } {putlog "wrong path"return 0}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Mon Apr 20, 2009 9:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dmg]]></name></author>
		<updated>2009-04-20T22:08:04-04:00</updated>

		<published>2009-04-20T21:17:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88518#p88518</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88518#p88518"/>
		<title type="html"><![CDATA[dccsend with arguments security issue [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88518#p88518"><![CDATA[
Hi guys!<br><br>I'm a beginner at tcl scripting and i've made a script that looks something like this:<br><div class="codebox"><p>Code: </p><pre><code>set chan "#ascii"set botdir  "/home/dmg/hosee2"set rootdir "$botdir/filesys"set scrver   "getdiz"set author   "dmg"bind pub v !get get_fileproc get_file { nick uhost hand chan args } {  global rootdir  global scrver  global author  regsub -all -nocase {[^[:alnum:][][$\\]._()!'?^-]} [lindex $args 0] {} arg  if { [llength $arg] != 1 } {putchan $chan "Usage: !get \[\[path\] &lt;filename&gt;\]"return 0  } else {  set find "$rootdir/$arg"  set send [dccsend $find $nick]  putchan $chan "requesting transfer of $arg to $nick"  if { [passwdok $hand ""] == 1 } {putchan $chan "you have to set a password (or maybe you must identify yourself?)."return 0  }  if { $send == 0 } { putchan $chan "\002ok!\002 sending file" }  if { $send == 1 } { putchan $chan "too many connections. try again later)" }  if { $send == 2 } { putchan $chan "can't open a socket for the transfer. try again later" }  if { $send == 3 } { putchan $chan "the file $arg \002does not exist\002 (maybe you entered the wrong path?)" }  if { $send == 4 } { putchan $chan "too many simultanious transfers. putting file in queue" }  putchan $chan "---==(\\/)- $scrver by $author -(\\/)==---"  return 1  }}putlog "$scrver by $author"</code></pre></div>Everything is fine and dandy except that i found out that it will accept any kind of argument to it so using !get ../../filename or whichever path/file not limited by local rights settings would be possible.<br><br>My question is: How could i limit the script/argument to refuse access outside of the $rootdir variable?<br><br>..oh, and if you wonder, the regexp is because the files in my archive (ascii art), can sometimes have crazy characters in the filename.<br><br>Please be gentle with me since i haven't quite understood how everything works and what everything does yet <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10612">dmg</a> — Mon Apr 20, 2009 9:17 pm</p><hr />
]]></content>
	</entry>
	</feed>
