Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path escape issue when connecting to a Windows Server #59

Open
Genteure opened this issue Jan 28, 2017 · 2 comments
Open

Path escape issue when connecting to a Windows Server #59

Genteure opened this issue Jan 28, 2017 · 2 comments
Labels

Comments

@Genteure
Copy link

Genteure commented Jan 28, 2017

when I change my working directory to something like E:\ or C:\, I can't execute any command.
seems like the problem is chdir('E:\');

my log:

[D][php] PAYLOAD chdir('E:\');@error_reporting(0);@system('dir 2>&1');
>>>> cd E:Code
[D][php] PAYLOAD chdir('E:\');@error_reporting(0);
                if(is_callable('posix_getpwuid')&&is_callable('posix_geteuid')) {
                    $u=@posix_getpwuid(@posix_geteuid());
                    if($u){
                        $u=$u['name'];
                    } else {
                        $u=getenv('username');
                    }
                    print($u);
                }
            
[D][php] PAYLOAD chdir('E:\');@error_reporting(0);@chdir('E:Code')&&print(@getcwd());
[-][cd] Failed cd 'E:Code': no such directory or permission denied
>>>> cd E:/Code
[D][php] PAYLOAD chdir('E:\');@error_reporting(0);
                if(is_callable('posix_getpwuid')&&is_callable('posix_geteuid')) {
                    $u=@posix_getpwuid(@posix_geteuid());
                    if($u){
                        $u=$u['name'];
                    } else {
                        $u=getenv('username');
                    }
                    print($u);
                }
@epinna
Copy link
Owner

epinna commented Jan 28, 2017

I'll check this. As temporary fix, you could try not sending chdir('E:\'); changing E:/ to something else in this code snippet you should fine in the session file under ~/.weevely/.

file_cd:
  results:
    cwd: E:/ 

Remove the file or change E:/ to something else - Not sure if it works, but give it a try.

@epinna epinna added the bug label Jan 28, 2017
@FirePing32
Copy link

There seems to be insufficient permissions in the E: directory. Open CMD in E: with admin permissions and try again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants