pwntools icon indicating copy to clipboard operation
pwntools copied to clipboard

Fix inconsistent comparison of sets in encode when using regular expression

Open p0ise opened this issue 2 years ago • 1 comments

In this code:

67    if expr:
68        for char in all_chars:
69            if re.search(expr, char):
70                avoid.add(char)

which make avoid something like {'a', 'b'}.

But set() of bytes would be {some ints}.

This will invalidate the following conditions because they can never intersect:

79        if encoder.blacklist & avoid:
...
87        if avoid & set(v):

p0ise avatar Oct 23 '22 06:10 p0ise

Thank you! Current implementation of shellcode encoders is a mess in general, so I will take a look at it later.

Arusekk avatar Oct 23 '22 07:10 Arusekk