Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsLearn about Cross-site Scripting (XSS) vulnerabilities in an interactive lesson.
Start learningUpgrade elgg/elgg
to version 4.0.6, 3.3.24 or higher.
elgg/elgg is a development framework used for creating socially aware web applications.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) due to missing sanitization of the user input into the address
request parameter.
This behavior allows authenticated users to report a page to administrator, and instead of inserting the page address it is possible to insert a malicious script.
1 => Having your Elgg instance, create two different accounts (administrator and normal user);
2 => Logged in as the normal user, go to the Blogs page, and click on any blog (if there is none, you can create one yourself);
3 => Once in the blog page, click on the three dots in the right side of the window, and select the option "Report this". A form will be opened, so that you can specify what exactly is the problem with the page you are reporting;
4 => If you are using a proxy tool, enable the intercept functionality, and then going back to Elgg, click on "Report this". If you are going to use the browser Dev Tools, just open it on the network tab;
5 => Seeing the request that is being sent to
/elgg/action/reportedcontent/add
, change the address parameter to the script below, and then forward the request. If you are using Dev Tools, maybe you are going to need to edit the original request and re-send it.
javascript:alert(
${document.domain}\n${document.cookie})
6 => Now log in as the administrator, an go to the reports page, which can be found on
/admin/administer_utilities/reportedcontent
7 => In this page, you probably are going to see at first the report you sent containing a script, click on the reference to this report;
8 => After that, an alert will be popped out containing the domain where the code is coming from, and also the session cookies, which can be used as an authentication method for anyone who has it.
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
?
, &
, /
, <
, >
and spaces to their respective HTML or URL encoded equivalents.