ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 340 - CS0-003 discussion

Report
Export

A web application has a function to retrieve content from an internal URL to identify CSRF attacks in the logs. The security analyst is building a regular expression that will filter out the correctly formatted requests. The target URL is https://10.1.2.3/api, and the receiving API only accepts GET requests and uses a single integer argument named 'id.' Which of the following regular expressions should the analyst use to achieve the objective?

A.

(?!https://10\.1\.2\.3/api\?id=[0-9]+)

Answers
A.

(?!https://10\.1\.2\.3/api\?id=[0-9]+)

B.

'https://10\.1\.2\.3/api\?id=\d+

Answers
B.

'https://10\.1\.2\.3/api\?id=\d+

C.

(?:'https://10\.1\.2\.3/api\?id-[0-9]+)

Answers
C.

(?:'https://10\.1\.2\.3/api\?id-[0-9]+)

D.

https://10\.1\.2\.3/api\?id[0-9J$

Answers
D.

https://10\.1\.2\.3/api\?id[0-9J$

Suggested answer: B

Explanation:

The correct regular expression to match a GET request to this API endpoint is 'https://10\.1\.2\.3/api\?id=\d+'. This pattern checks for the specific URL with an id parameter that accepts integer values. The syntax \d+ matches one or more digits, which aligns with the requirement for a single integer argument. Other options either use incorrect syntax or do not accurately capture the expected URL format. Regular expressions are vital in filtering and identifying patterns in logs, as recommended by CompTIA Cybersecurity Analyst (CySA+) practices for threat hunting and log analysis.

asked 17/10/2024
Wojciech Oleksiak
37 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first