view MoinMoin/xmlrpc/ @ 5910:7e7e1cbb9d3f

security: fix remote code execution vulnerability in twikidraw/anywikidraw actions We have wikiutil.taintfilename() to make user supplied filenames safe, so that they can't contain any "special" characters like path separators, etc. It is used at many places in moin, but wasn't used here. :|
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 29 Dec 2012 15:05:29 +0100
parents e5a9570d3001
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - Remote Script Execution Server part

    @copyright: 2006 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.

from MoinMoin import log
logging = log.getLogger(__name__)

from MoinMoin.script import MoinScript

def execute(xmlrpcobj, their_secret, argv):
    request = xmlrpcobj.request
    their_secret = xmlrpcobj._instr(their_secret)

    our_secret = request.cfg.secrets['xmlrpc/RemoteScript']

    if our_secret != their_secret:
        return u"Invalid password"

    try:"RemoteScript argv: %r" % argv)
    except Exception, err:
        logging.exception('An exception occurred.')
        return xmlrpcobj._outstr(str(err))
    return xmlrpcobj._outstr(u"OK")