3v4l.org

run code in 300+ PHP versions simultaneously
<?php function lfi_be_gone($userProvided, $basePath) { $real = realpath($userProvided); if ($real === false) { throw new Exception('LOL NOPE'); } if (strpos($real, $basePath) !== 0) { throw new Exception('LOL NOPE'); } return $real; } # Usage: $userProvidedVariable = '../../../../../../../../etc/passwd'; require_once lfi_be_gone("includes/" . $userProvidedVariable, $_SERVER['DOCUMENT_ROOT'] . '/includes/');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UFqfm
function name:  (null)
number of ops:  11
compiled vars:  !0 = $userProvidedVariable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, '..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2Fetc%2Fpasswd'
   21     1        INIT_FCALL                                               'lfi_be_gone'
          2        CONCAT                                           ~2      'includes%2F', !0
          3        SEND_VAL                                                 ~2
          4        FETCH_R                      global              ~3      '_SERVER'
          5        FETCH_DIM_R                                      ~4      ~3, 'DOCUMENT_ROOT'
          6        CONCAT                                           ~5      ~4, '%2Fincludes%2F'
          7        SEND_VAL                                                 ~5
          8        DO_FCALL                                      0  $6      
          9        INCLUDE_OR_EVAL                                          $6, REQUIRE_ONCE
         10      > RETURN                                                   1

Function lfi_be_gone:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UFqfm
function name:  lfi_be_gone
number of ops:  24
compiled vars:  !0 = $userProvided, !1 = $basePath, !2 = $real
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'realpath'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
    6     6        TYPE_CHECK                                    4          !2
          7      > JMPZ                                                     ~5, ->12
    7     8    >   NEW                                              $6      'Exception'
          9        SEND_VAL_EX                                              'LOL+NOPE'
         10        DO_FCALL                                      0          
         11      > THROW                                         0          $6
   10    12    >   INIT_FCALL                                               'strpos'
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $8      
         16        IS_NOT_IDENTICAL                                         $8, 0
         17      > JMPZ                                                     ~9, ->22
   11    18    >   NEW                                              $10     'Exception'
         19        SEND_VAL_EX                                              'LOL+NOPE'
         20        DO_FCALL                                      0          
         21      > THROW                                         0          $10
   14    22    > > RETURN                                                   !2
   15    23*     > RETURN                                                   null

End of function lfi_be_gone

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
129.25 ms | 1407 KiB | 18 Q