Visit our newest sister site!
Hundreds of free aircraft flight manuals
Civilian • Historical • Military • Declassified • FREE!

TUCoPS :: Web :: Apps :: eperl2~1.htm

ePerl can be made to process untrusted files





    David Madison  found following.   ePerl allows  the user  to embed
    perl code (specified inside ePerl delimiters) in HTML.  ePerl  has
    the  ability  to  "safely"  include  untrusted  files  using   the
    #sinclude directive.   The untrusted  file is  not supposed  to be
    able to  specify any  perl code  to run,  but this  safe mode  can
    easily be circumvented.

    The  #sinclude   directive  operates   by  replacing   the   ePerl
    delimiters on the untrusted file  so that they are ignored  during
    parsing.  The problem is  that it still follows the  preprocessing
    directives, so the  untrusted file can  then include another  file
    while not in safe mode.

    As an example, consider  two files, one that  we own and one  that
    we sinclude.

    File my_machine.html:

        Here is information from some other source:

    Now, #sinclude is supposed to keep from putting any  perl
    code in untrusted.html,  but they still  can, because they  can do
    this; file

        Perl code in this file is ignored, but:


        Any perl code we want...
        <: system("rm -Rf /"); :>

    Then when someone views  the file my_machine.html, ePerl  will run
    the malicious code on the machine with the ePerl server.


    1) Temporarily turn off preprocessing when you enter an  #sinclude
    2) Convert all #includes into #sincludes inside an #include file.
    3) Move the delimiter replacement *into* the ePerl_PP_Process call
       as   opposed   to    after   it   -    in   addition,    ignore
       #if/elsif/else/endif  and  finally  convert  all  #include   to
    4) Use  the  smaller  and  more  secure  ePerl replacement  that's
       written in perl:

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2015 AOH