Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 663c976

Browse files
committed
Fixes #1600
1 parent 2eb5f5e commit 663c976

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

lib/core/convert.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
import pickle
1111
import StringIO
1212
import sys
13+
import types
1314

1415
from lib.core.settings import IS_WIN
1516
from lib.core.settings import UNICODE_ENCODING
17+
from lib.core.settings import PICKLE_REDUCE_WHITELIST
1618

1719
def base64decode(value):
1820
"""
@@ -71,7 +73,7 @@ def base64unpickle(value):
7173
def _(self):
7274
if len(self.stack) > 1:
7375
func = self.stack[-2]
74-
if '.' in repr(func) and " 'lib." not in repr(func):
76+
if func not in PICKLE_REDUCE_WHITELIST:
7577
raise Exception, "abusing reduce() is bad, Mkay!"
7678
self.load_reduce()
7779

lib/core/settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
import string
1212
import sys
1313
import time
14+
import types
1415

16+
from lib.core.datatype import AttribDict
1517
from lib.core.enums import DBMS
1618
from lib.core.enums import DBMS_DIRECTORY_NAME
1719
from lib.core.enums import OS
@@ -427,6 +429,8 @@
427429
# Table used for Base64 conversion in WordPress hash cracking routine
428430
ITOA64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
429431

432+
PICKLE_REDUCE_WHITELIST = (types.BooleanType, types.DictType, types.FloatType, types.IntType, types.ListType, types.LongType, types.NoneType, types.StringType, types.TupleType, types.UnicodeType, types.XRangeType, type(AttribDict()), type(set()))
433+
430434
# Chars used to quickly distinguish if the user provided tainted parameter values
431435
DUMMY_SQL_INJECTION_CHARS = ";()'"
432436

0 commit comments

Comments
 (0)