Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does =_= mean in JavaScript or HTML?

Tags:

javascript

xss

Reading this XSS cheat sheet, I noticed a special usage I have never seen:

<img src="/" =_=" title="onerror='prompt(1)'">

What does "=_=" mean? It's below the sentence "On Mouse Over​".

like image 436
Billy Chung Avatar asked Dec 23 '21 04:12

Billy Chung


People also ask

What does '$' mean in JavaScript?

Updated on July 03, 2019. The dollar sign ($) and the underscore (_) characters are JavaScript identifiers, which just means that they identify an object in the same way a name would. The objects they identify include things such as variables, functions, properties, events, and objects.

What is use of in JavaScript?

The JavaScript in operator is used to check if a specified property exists in an object or in its inherited properties (in other words, its prototype chain). The in operator returns true if the specified property exists. Anatomy of a simple JavaScript object.

What does 1 mean in JavaScript?

-1 means the first goes before the second, 1 means it goes after, and 0 means they're equivalent.

What is = in JavaScript?

What is = in JavaScript? Equal to (=) is an assignment operator, which sets the variable on the left of the = to the value of the expression that is on its right. This operator assigns lvalue to rvalue. For example, Writing a=10 is fine.

What is the difference between = and == in JavaScript?

= in JavaScript is used for assigning values to a variable. == in JavaScript is used for comparing two variables, but it ignores the datatype of variable. === is used for comparing two variables, but this operator also checks datatype and compares two values.

How does the or operator work in JavaScript?

The “OR” operator is represented with two vertical line symbols: In classical programming, the logical OR is meant to manipulate boolean values only. If any of its arguments are true, it returns true, otherwise it returns false. In JavaScript, the operator is a little bit trickier and more powerful.

What is logical or in JavaScript?

In classical programming, logical OR is meant to manipulate boolean values only. If any of its arguments are true, then it returns true, otherwise it returns false. In JavaScript the operator is a little bit more tricky and powerful.


Video Answer


1 Answers

It's just an attribute on the element. It doesn't have any meaning by itself, so it may be present simply as a red herring.

Prettified, the code is:

<img
  src="/"
  =_=" title="
  onerror='prompt(1)'"
>

In HTML, = in an attribute specifies the delimiter between the attribute name and the attribute value, so it's:

=_=" title="
^^ attribute name

=_=" title="
  ^ delimiter between attribute name and attribute value

=_=" title="
   ^ attribute value contents delimiter

=_=" title="
    ^^^^^^^ attribute value

=_=" title="
           ^ attribute value contents delimiter

And you could retrieve the attribute value if you wanted.

const img = document.querySelector('img');
console.log(img.getAttribute('=_'));
<img
  src="/"
  =_=" title="
  onerror='prompt(1)'"
>

Note that the attribute name is =_, not =_= - the final = is the delimiter, not part of the attribute name.

The "XSS" is caused only by the src and the onerror, not by anything else. Wherever you're encountering this, the =_ probably doesn't do anything at all. It could, but it probably doesn't.

<img src="/" onerror='prompt(1)'">
like image 66
CertainPerformance Avatar answered Nov 11 '22 18:11

CertainPerformance