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

Unparseable vulnerable pattern #5

Open
davisjam opened this issue Feb 26, 2018 · 2 comments
Open

Unparseable vulnerable pattern #5

davisjam opened this issue Feb 26, 2018 · 2 comments

Comments

@davisjam
Copy link
Contributor

davisjam commented Feb 26, 2018

The following pattern is vulnerable.
I found it in marked (in that discussion it is a more complex version of "n.2" which the detector does catch).

 /^<!--[\s\S]*?-->|^<\/?[a-zA-Z0-9\-]+(?:"[^"]*"|'[^']*'|\s[^<'">\/]*)*?\/?>/

It can be exploited with prefix <tag pump \t\t"" suffix <"\t/>a'a.

However, the detector says 'SKIPPED'. Not sure why.

$ java -cp 'weideman-RegexStaticAnalysis/bin:lib/gson-2.8.2.jar' driver.Main -i /tmp/query.regex --test-eda-exploit-string=false --ida=true --timeout=0 --full --ida=true 2>&1
---Interface settings:---
Input type:			FILE_INPUT
Is Verbose:			true
---Analysis settings:---
NFA Construction:		JAVA
Preprocessing type:		NONE
Epsilon loop removal:		FLATTENING
Priority removal:		UNPRIORITISE
Testing for IDA:		true
Construct EDA exploit strings:	true
Testing EDA exploit strings:	false
Construct IDA exploit strings:	true
Timeout:			DISABLED
------------------------
1. pattern = "^<!--[\s\S]*?-->|^<\/?[a-zA-Z0-9\-]+(?:"[^"]*"|'[^']*'|\s[^<'">\/\s]*)*?\/?>"
SKIPPED
Analysed:	0/1
	Safe:		0/1
	Vulnerable:	0/1
		EDA:		0/1
		IDA:		0/1
	Vulnerable EDA:	[]
	Vulnerable IDA:	[]
Skipped:	1/1
Timeout:	0/1
		EDA:	0/1
		IDA:	0/1
Total running time: 8
@davisjam
Copy link
Contributor Author

Perhaps the issue is the use of '^...|^...', which is an unusual construction?

@davisjam
Copy link
Contributor Author

davisjam commented Feb 26, 2018

Confirmed. This pattern is detected as vulnerable.

/<!--[\s\S]*?-->|<\/?[a-zA-Z0-9\-]+(?:"[^"]*"|'[^']*'|\s[^<'">\/]*)*?\/?>/

(note there is now no '^' leading the disjunctions).

Is the '^...|^...' construction legal in Java?

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