Skip to content

Pass NULL pointer to LXSS_CONSOLE_DATA will crash other bash process #790

Closed

Description

@Yangff

I'm playing lxss and trying to run a process without bash as easy as possible, and I found if I pass zero for LXSS_CONSOLE_DATA to ILxssInstance->CreateLxProcess for example, rst = ins->CreateLxProcess("/usr/bin/whois", 2, args, 4, CODE, "/root/", 0, &std_handle, NULL, 0, &hProcess);

The function returns -2147024832 and then my running bash crash. I think this function is not designed to be that..

If I pass a pointer to LXSS_CONSOLE_DATA (fill with zero) the function return with error but it will not crash other process.

I'm using 14393.10

PS. I guess this function looks like (I'm not sure about this, but I means you can crush it by using these arguments)

struct LXSS_STD_HANDLES {
    /* For old console ? */
    /* HI POS === 1 */
    HANDLE STDIN; /* STDIN (create pipe) */
    HANDLE STDOUT; /* STDOUT */
    HANDLE STDERR; /* STDERR */
    /* all zero if LXSS_CONSOLE_DATA used */
};
struct LXSS_CONSOLE_DATA { 
    /* unclear... */
    /* low 32 bits of LXSS_STD_HANDLES (?) */
    DWORD IN_BUF; /* For keys (arrors...) */
    DWORD OUT_BUF; /* STDOUT (console) */
    DWORD IN_EVENT; /* for example resize.... */
    /* Buffer.EventType != 1, Buffer.EventType == 4 */

    WORD SCREEN_WIDTH;
    WORD SCREEN_HEIGHT;
    /* GetConsoleScreenBufferInfo */
    /*
      ConsoleScreenBufferInfo.srWindow.Right - ConsoleScreenBufferInfo.srWindow.Left + 1;
      ConsoleScreenBufferInfo.srWindow.Bottom - ConsoleScreenBufferInfo.srWindow.Top + 1;
    */
};
    virtual int CreateLxProcess(
        char const * exec /* in linux */ ,
        unsigned long argc, 
        char const ** args,
        unsigned long env_count, 
        char const ** env,
        char const * current_path /* maybe */,
        unsigned long keep_runing, /* 0 for bash -c xxx 1 for other */
        LXSS_STD_HANDLES *_LXSS_STD_HANDLES,
        LXSS_CONSOLE_DATA *_LXSS_CONSOLE_DATA,
        unsigned long uid /* =0 or read from reg */, 
        HANDLE * process /* &v =0 */) = 0;

Activity

  1. fpqc commented on Aug 6, 2016

    @fpqc

    Cool project hope MS documents more of this!

  2. benhillis commented on Apr 18, 2017

    @benhillis
    Member

    I was not able to reproduce this. When I pass NULL as that parameter I get the expected COM error message:

    Error code: (HRESULT) 0x800706f4 (2147944180) - A null reference pointer was passed to the stub.

    If you are still able to reproduce this behavior on Creator's Update could you please reopen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions