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

Bypass File Uploading restrictions leads to Command Execution #674

Open
t0gu opened this issue Sep 18, 2020 · 10 comments
Open

Bypass File Uploading restrictions leads to Command Execution #674

t0gu opened this issue Sep 18, 2020 · 10 comments

Comments

@t0gu
Copy link

t0gu commented Sep 18, 2020

Hello all, I was testing the upload mechanism, and I found that it is possible to bypass the protection for .php files by placing the .php inside a .zip file and extracting it. Once this is done, it is possible to execute commands on the machine using a malicious php file (webshell). Okay, that and the viability decreased a little because it is an admin functionality, however, if it is not allowed to upload a .php file, then placing the same file inside a .zip and extracting and executing it should also not be allowed .

  • Steps to reproduce
    1- As admin go to Content menu and click on Uploaded files
    2- Inside the try to upload a .php file, and
    3- try to upload a .php file directly, check that it is not possible.
    4- Take the same .php file and place it in a .zip and upload it.
    5- Extract through functionality and open the .php file
    Obs: A strange behavior was that, after extracting the PHP file in functionality, it is seen as HTML.

  • PoC
    ==> Executing Commands

poc_f

==> Try to upload a .php direct

test

@t0gu t0gu changed the title Bypass File upload leads to Command execution Bypass File Uploading restrictions leads to Command Execution Sep 18, 2020
@mahotilo
Copy link
Contributor

I can't extract php from zip. How do you do this?

image

@t0gu
Copy link
Author

t0gu commented Sep 18, 2020

sorry if i explained it wrong. I made a gif. step by step.
poc_01

@mahotilo
Copy link
Contributor

Oh, I see. Which version are you using? This is definitely not the current master from here.

@t0gu
Copy link
Author

t0gu commented Sep 18, 2020

@mahotilo 5.1 like the image bellow

Screenshot_2020-09-18_15-13-25

i got from latest releases. Theres another version ? more recent ? one more time sorry about my explanation :(

@mahotilo
Copy link
Contributor

mahotilo commented Sep 18, 2020

If you are trying to make an issue, please consider using the latest version.

EDIT
Hint
image

@t0gu
Copy link
Author

t0gu commented Sep 18, 2020

i'll testing on that version too =). One question, this issue was reported before ? at the version 5.1 ?

@mahotilo
Copy link
Contributor

As far as I remember, this was known to the developers.

@juek
Copy link
Member

juek commented Sep 18, 2020

I can confirm it works in Versions 5 - 5.1.
It didn't work in 4.x versions.

@t0gu

i'll testing on that version too =)

If you still manage to get it working with current master (5.2-rc) please report.
It shouldn't be possible unless you change related settings in /gpconfig.php

One question, this issue was reported before?

It was not reported but there were rumors about sth. like that. Allegedly it is part of an exploit suite that can be bought. However, rather dubious sources IMO.

While this is an 'authenticated RCE', which clearly contradicts our security policy, Typesetter is not a community platform and there is no way to register user accounts yourself, which could do such things. So, Typesetter admins are considered trustworthy.

Nevertheless it is something that must not happen and Typesetter 5.2 will prevent it AFAIK.

@t0gu
Copy link
Author

t0gu commented Sep 18, 2020

@juek thanks to confirm =) i'm testing on version 5.2 and was fixed.

@oyejorge
Copy link
Member

I just tested on 5.2 as well and could not extract the php file.

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

No branches or pull requests

4 participants