Django framework Arbitrary File Inclusion Vulnerability

Source: Internet
Author: User

Django framework Arbitrary File Inclusion Vulnerability
On July 6, April 21, the python-based open-source web framework Django released a Security Bulletin, saying that the contrib. markup package in MySQL 1.5 or earlier has the Arbitrary File Inclusion Vulnerability. Attackers can use docutils to launch attacks. The docutils Docutils project mainly aims to create a set of tools for converting plain text into some common formats, including HTML, XML, and LaTeX. Docutils data packets are standard data packets that render reStructuredText (reST. One of the reST features is to include other files in one document. It is enabled by default. In Django ≤ 1.5, contrib. the markup package depends on docutils and provides template filters for rendering reST to HTML on demand. However, it does not disable the problematic option when the file system contains local files. If docutils is rendered using a malicious statement entered by the user and no commands are disabled, attackers can read arbitrary files on the host (at least files accessible to users running WSGI containers ). This will expose some sensitive files or configuration information of users. Although Django1.6 deletes the contrib. markup app, third-party apps in many Djangoverse still depend on docutils and copy the Django mode:

docutils_settings = getattr(settings, ‘RESTRUCTUREDTEXT_FILTER_SETTINGS’, {})parts = publish_parts(source=smart_bytes(value),writer_name=”html4css1″,settings_overrides=docutils_settings)return force_text(parts[“fragment”])

 

To solve the problem of Arbitrary File Inclusion, the data packet maintainer should adopt the following mode: these packages may not contain the same warnings as the Django document, however, in any case, file inclusion should be disabled by default to ensure security, rather than manual configuration.
docutils_settings = {‘raw_enabled': False,‘file_insertion_enabled': False,}docutils_settings.update(getattr(settings, ‘RESTRUCTUREDTEXT_FILTER_SETTINGS’, {}))parts = publish_parts(source=smart_bytes(value),writer_name=”html4css1″,settings_overrides=docutils_settings)return force_text(parts[“fragment”])

 

The package user who uses the preceding mode also needs to update the project settings and add the following information:
RESTRUCTUREDTEXT_FILTER_SETTINGS = {‘raw_enabled': False,‘file_insertion_enabled': False,}

 


Related Article

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.