Rating:

The Varsity - Web

In this challenge we got a website that allows reading newspapers but some of the newspapers are for subscribers.

We also got the source code.

We can see that article 10 is only for subscribers.

I could not find a way to be a subscriber (bypassing the voucher option in the registration form) so I checked for business logic related bugs.

If we enter '9' (which is actually the 10th issue) as the issue number, the code will enter the second 'if' and will return an error.

However, if we enter '9;' as the issue number, it will not enter the second 'if' because

issue >= 9
results in 'false' as '9;' could not be parsed as a number.

When the '9;' enters:

issue = parseInt(issue);
the 'issue' variable will be 9 since parseInt parses everything until the first non-number character.

Because it is a number, it does not enter

if (Number.isNaN(issue) || issue > articles.length - 1) {
And then it retrieves issue number 9:

uoftctf{w31rd_b3h4v10r_0f_parseInt()!}

Original writeup (https://www.thesecuritywind.com/post/uoftctf-2024-writeups#viewer-qdfm150837).