You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exercises/10/problem.md
+16-6Lines changed: 16 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,29 @@ Fortunately, your competitor just deployed a new version of their site that incl
4
4
5
5
The feature is called "Competitor Comparison" and it includes links to competitor search engines so that users can compare search results and decide which search engine is best. Clearly, they feel pretty confident that their results are the best.
6
6
7
-
They appear to be using the foolproof `htmlElementEscape()` function written for them by the Stanford CS 253 student to generate the HTML for these links so you think they're guaranteed to be safe.
7
+
They appear to be using the foolproof `htmlElementEscape()` function written for them by the Stanford CS 253 student to generate the HTML for these links so you think they're guaranteed to be safe:
8
8
9
-
But upon closer inspection, it appears that they're not using the function correctly. Time to teach them another lesson!
9
+
```js
10
+
router.get('/search', async (req, res) => {
11
+
let q =req.query.q
12
+
if (q ==null) q =''
13
+
14
+
q =htmlElementEscape(q)
10
15
11
-
## Goals
16
+
constresults=awaitgetResults(q)
17
+
res.render('caloogle-search-page', { q, results })
18
+
})
19
+
```
20
+
21
+
But upon closer inspection, it appears that they're not using the function correctly. Time to teach them another lesson!
12
22
13
-
1. Find the XSS vulnerability in the search input field. You can use any HTML you want to run the `success()` function.
23
+
## Goal
14
24
15
-
1. Write out the code that you believe the server must be executing to process the input.
25
+
Find the XSS vulnerability in the search input field. You can use any HTML you want to run the `success()` function.
16
26
17
27
## Tip
18
28
19
-
Try submitting various inputs and then look at the HTML source of the `<iframe>` to figure out what their sanitization code must be doing.
29
+
Try submitting various inputs and then look at the HTML source of the `<iframe>` to figure out how the "sanitized" user input interacts with the context of the HTML source.
0 commit comments