Coder Social home page Coder Social logo

Comments (5)

jvoisin avatar jvoisin commented on June 3, 2024

Suhosin7 is doing it like us, but I don't think that they tested it.

from snuffleupagus.

jvoisin avatar jvoisin commented on June 3, 2024

This is what our function looks like:

static int sp_stream_open(const char *filename, zend_file_handle *handle) {
  zend_execute_data const * const data = EG(current_execute_data);
  if ((NULL == data) || (NULL == data->opline)) {
    goto end;
  }
                                                                       
  switch(data->opline->opcode) {
    case ZEND_INCLUDE_OR_EVAL:
      if (true == SNUFFLEUPAGUS_G(config).config_readonly_exec->enable) {
        terminate_if_writable(filename);
      }
      construct_include_handler(filename);
  }  

end:
  return orig_zend_stream_open(filename, handle); 
}  

Apparently, data->opline is equal to 0x2, and thus can't be dereferenced to access the opcode member. This doesn't make any sense.

Some values are garbage in the data structure, but apparently in php, it's an accepted behaviour, and doesn't necessary means that there is a bug somewhere :/

from snuffleupagus.

jvoisin avatar jvoisin commented on June 3, 2024

People are doing additionnal checks:

        } else if (
            data &&
            data->prev_execute_data &&
            data->prev_execute_data->func->type == ZEND_USER_FUNCTION &&
            data->prev_execute_data->opline &&
            data->prev_execute_data->opline->opcode == ZEND_INCLUDE_OR_EVAL
        ) {

So I did the same (because I'm lazy and it's getting late). Care to test them @xXx-caillou-xXx ?

from snuffleupagus.

xXx-caillou-xXx avatar xXx-caillou-xXx commented on June 3, 2024

It looks like it's working.

from snuffleupagus.

jvoisin avatar jvoisin commented on June 3, 2024

from snuffleupagus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.