Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unpack question #276

Open
jsmith173 opened this issue Mar 25, 2024 · 1 comment
Open

unpack question #276

jsmith173 opened this issue Mar 25, 2024 · 1 comment
Labels

Comments

@jsmith173
Copy link

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?

@d-maurer
Copy link
Contributor

d-maurer commented Mar 25, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants