Jother Code __

Source: Internet
Author: User

This article summarizes from the cloud http://drops.wooyun.org/web/4410, this paper is for notes, if there is no understanding welcome to discuss or to the original author.


Jother Coding Features:

1, simple, do not need too much knowledge of the algorithm.

2, is the JavaScript has a deeper understanding of the product.


Pre-study Preparation:

1, JavaScript anonymous function related knowledge

2. JavaScript related functions

3. JavaScript Variable Type basics

4, the Recursive thought


Jother Encoding: Jother encoding is the encoding of compact anonymous function pairs and strings using a few specific characters in a JavaScript language. I understand that JavaScript uses a small number of specific characters to encode and encrypt anonymous functions. A small number of specific characters include: "+", ". ”、“(”、“)”、“[”、“]”、“{”、“}"。 Thus, 1, recursion in the coding process is necessary. 2, coding compression rate is greater than 100% or higher, that is, the length of the code after a lot longer than the original length.


See the following example:

alert ([function () {
		alert (1);
	} ()])

First eject 1 after execution, then eject the empty window. Alert (1) is executed first, and the outer alert ejects the return value of the function.

Alert (function () {document.write (' AA ');});
After the execution pops up a AA and the Web page shows AA. In other words, alert can execute functions.


alert ([]);//"[]" is the simplest function that does nothing after execution and returns void.
	alert (+[]);//Operator "+" casts the return value void to the number 0
	alert (![)); /operator. "Casts the return value void to a Boolean value false." This is. does not reverse void, but simply converts void to a Boolean type.
	Alert (!! []);//convert above false to True
	alert (+!! []);//Converts the above true to number 1.

From the above code, we get the number 0, 1 expression. So we got all the integers again.

"+[]",                                            //0
"+!! [] ",                                           //1
"!! []+!! [] ",                                       //2
"!! []+!! []+!! [] ",                                  //3
"!! []+!! []+!! []+!! [] ",                             //4
"!! []+!! []+!! []+!! []+!! [] ",                        //5
"!! []+!! []+!! []+!! []+!! []+!! [] ",                   //6
"!! []+!! []+!! []+!! []+!! []+!! []+!! [] ",              //7
"!! []+!! []+!! []+!! []+!! []+!! []+!! []+!! [] ",         //8
"!! []+!! []+!! []+!! []+!! []+!! []+!! []+!! []+!! [] "     //9

It's cool, isn't it. Only numbers are not enough, we need characters, strings. So how does a number become a string? Here's a bit of an article to do, and the first thing I thought of was the ASCII code, but how do I convert ASCII code to characters? We need to introduce functions, but we can not introduce new functions. Let's think about this in a different way: try to generate an array and then specify the subscript display directly with the characters already in the array. For example, we can easily produce "true", "false". We want to say "a" directly to find a way to output a "false", and then make the subscript "1" (note here "F" subscript is "0", so "a" is "1") is not OK.

Let us confirm:

Alert ((![)) [+!! []])

What do you think. Did you see a. If you answer, "see," then you're definitely not doing it seriously. The output here is "undefined", which is why. Because! [] is false this false is bool type, when we take a bool variable subscript when the JavaScript is not allowed, so here is a undefined. So how do we find a way to convert a bool to a string? Here's what's used: "! []+[] ".

Alert (typeof (![) +[]))

Did you see it? into a string. Here's how JavaScript casts a "+" operation on the bool type and number type to the string type. You can also use alert (typeof (XXX)) to try to determine whether the types mentioned previously were correct.

Using this method, we can express "a", "E", "F", "L", "R", "s", "T", "U". Of course, there is a very easy to get the string-"undefined", but also to enrich our dictionary. So there are still a lot of characters that can't be represented, and we're going to talk about an extension, Object:

Alert ({});
In JavaScript, "{}" represents the simplest class, and if you run the above code, you will see "[Object]", and the same object cannot get the element directly by the array subscript. Smart Friends, you know how to get the "[Object]" character. That's it:

Alert (typeof ({}+[]));
Alert (({}+[]) [+[]]);

So we get the first character "[". The main thing to do with this extension is to get an important character "O", because the sort function we're going to say later needs to be used.

First we're going to add a predecessor concept--javascript the primitive form of anonymous function

[] [' sort '] [' constructor '] (' function body ') ();
Such constructs can execute arbitrary javascript code.

Using Jother encoding can be used without letters and numbers to execute arbitrary JS code, this is very useful in XSS attacks, the only disadvantage is that the code is too long, how to shorten the code, in fact, there are some ways, and combined with real attack environment may allow the input of some characters, We can then refer to the replacement part of the code. For example, in the code for "alert" filtering, whether can use the Jother function, the anonymous function called "alert", when the call "alert" only replace the R in Alert, which formed the "ale" +xxx (jother) + "T" form.

The following is a formal introduction to using Jother encoding to invoke anonymous functions. In the first article we already have some strings, each of these characters we can take with the array subscript positioning, let's look at what these characters have: "true", "false", " Undefined ", [Object Object]" (Note that there is a useful character spaces). Let's contrast [] [' sort '] [' constructor ']1; we still lack anything. In fact, there is nothing missing. Let's construct a form like this so that I can directly give the result of the construct:

[][(! []+[])[!! []+!! []+!! []]+({}+[])[+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]][({}+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []]+(! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+[]]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(!! []+[])[+[]]+({}+[])[+!! []]+(!! []+[])[+!! []]]((!! []+[])[+!! []]+(!! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+({}[[]]+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []+!! []+!! []]+(! []+[])[!! []+!! []]+({}+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(! []+[])[+!! []]+(!! []+[])[+[]]+({}[[]]+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []])()
This example is actually equivalent to:

[[' Sort '] [' constructor '] (' Return location ') ()

Note that this is the space behind the return, which needs to be taken using the [object Object] we mentioned earlier.

With this function we can get a lot of useful characters, such as online, we can take the "HTTP (s)://" So that there is a new character "P".

With this character, we can use the escape and unescape functions to combine more letters and special matches, such as using Escape ("), get"%20 ", and then unescape the new character with"% "and a combination of numeric letters.

It's up to you to be free to play the back.

Of course, there are other techniques to construct some letters, such as the construction of the infinity is actually using the number approach infinity, the principle is to find a way to achieve e 100,000, we are not listed here, Specific ideas can refer to the attachment of the jother.js, this is the Jother inventor wrote a section of Jother encode demo.

Here we give an example of how alert (1) can be achieved without any letters or numbers in order to prove the first mentioned conjecture:

[][(! []+[])[!! []+!! []+!! []]+({}+[])[+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]][({}+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []]+(! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+[]]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(!! []+[])[+[]]+({}+[])[+!! []]+(!! []+[])[+!! []]]((! []+[])[+!! []]+(! []+[])[!! []+!! []]+(!! []+[])[!! []+!! []+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]+[][(! []+[])[!! []+!! []+!! []]+({}+[])[+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]][({}+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []]+(! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+[]]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(!! []+[])[+[]]+({}+[])[+!! []]+(!! []+[])[+!! []]]((!! []+[])[+!! []]+(!! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+({}[[]]+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []+!! []+!! []]+({}[[]]+[])[+[]]+({}[[]]+[])[+!! []]+(!! []+[])[!! []+!! []+!! []]+(! []+[])[!! []+!! []+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(! []+[])[+!! []]+([]+[][(! []+[])[!! []+!! []+!! []]+({}+[])[+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]][({}+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []]+(! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+[]]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(!! []+[])[+[]]+({}+[])[+!! []]+(!! []+[])[+!! []]]((!! []+[])[+!! []]+(!! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+({}[[]]+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []+!! []+!! []]+(! []+[])[!! []+!! []]+({}+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(! []+[])[+!! []]+(!! []+[])[+[]]+({}[[]]+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []])())[!! []+!! []+!! []]+(!! []+[])[!! []+!! []+!! []])()([][(! []+[])[!! []+!! []+!! []]+({}+[])[+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]][({}+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []]+(! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+[]]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(!! []+[])[+[]]+({}+[])[+!! []]+(!! []+[])[+!! []]]((!! []+[])[+!! []]+(!! []+[])[!! []+!![]+!! []]+(!! []+[])[+[]]+({}[[]]+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []+!! []+!! []]+(!! []+[])[!! []+!! []+!! []]+(! []+[])[!! []+!! []+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(! []+[])[+!! []]+([]+[][(! []+[])[!! []+!! []+!! []]+({}+[])[+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]][({}+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []]+(! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+[]]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(!! []+[])[+[]]+({}+[])[+!! []]+(!! []+[])[+!! []]]((!! []+[])[+!! []]+(!! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+({}[[]]+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []+!! []+!! []]+(! []+[])[!! []+!! []]+({}+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(! []+[])[+!! []]+(!! []+[])[+[]]+({}[[]]+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []])())[!! []+!! []+!! []]+(!! []+[])[!! []+!! []+!! []])()(({}+[])[+[]])[+[]]+(!! []+!! []+[])+(!! []+!! []+!! []+!! []+!! []+!! []+!! []+!! []+[]))+(+!! []+[])+[][(! []+[])[!! []+!! []+!! []]+({}+[])[+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]][({}+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []]+(! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+[]]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(!! []+[])[+[]]+({}+[])[+!! []]+(!! []+[])[+!! []]]((!! []+[])[+!! []]+(!! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+({}[[]]+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []+!! []+!! []]+({}[[]]+[])[+[]]+({}[[]]+[])[+!! []]+(!! []+[])[!! []+!! []+!! []]+(! []+[])[!! []+!! []+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(! []+[])[+!! []]+([]+[][(! []+[])[!! []+!! []+!! []]+({}+[])[+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]][({}+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []]+(! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+[]]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(!! []+[])[+[]]+({}+[])[+!! []]+(!! []+[])[+!! []]]((!! []+[])[+!! []]+(!! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+({}[[]]+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+!! []]+({}+[]) [!! []+!! []+!! []+!! []+!! []+!! []+!! []]+(! []+[])[!! []+!! []]+({}+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(! []+[])[+!! []]+(!! []+[])[+[]]+({}[[]]+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []])())[!! []+!! []+!! []]+(!! []+[])[!! []+!! []+!! []])()([][(! []+[])[!! []+!! []+!! []]+({}+[])[+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]][({}+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []]+(! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+[]]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(!! []+[])[+[]]+({}+[])[+!! []]+(!! []+[])[+!! []]]((!! []+[])[+!! []]+(!! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+({}[[]]+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []+!! []+!! []]+(!! []+[])[!! []+!! []+!! []]+(! []+[])[!! []+!! []+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(! []+[])[+!! []]+([]+[][(! []+[])[!! []+!! []+!! []]+({}+[])[+!! []]+(!! []+[])[+!! []]+(!! []+[])[+[]]][({}+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []]+(! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+[]]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(!! []+[])[+[]]+({}+[])[+!! []]+(!! []+[])[+!! []]]((!! []+[])[+!! []]+(!! []+[])[!! []+!! []+!! []]+(!! []+[])[+[]]+({}[[]]+[])[+[]]+(!! []+[])[+!! []]+({}[[]]+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []+!! []+!! []]+(! []+[])[!! []+!! []]+({}+[])[+!! []]+({}+[])[!! []+!! []+!! []+!! []+!! []]+(! []+[])[+!! []]+(!! []+[])[+[]]+({}[[]]+[])[!! []+!! []+!! []+!! []+!! []]+({}+[])[+!! []]+({}[[]]+[])[+!! []])())[!! []+!! []+!! []]+(!! []+[])[!! []+!! []+!! []])()(({}+[])[+[]])[+[]]+(!! []+!! []+[])+(!! []+!! []+!! []+!! []+!! []+!! []+!! []+!! []+!! []+[])))()

Note here that we use the encoding of ' (', ') ' to use escape and unescape, so use it under the HTTP (s)://protocol, and if it is a local file, the "file://" will not perform properly. Finally, the Jother encoding and decoding methods are given:

Code: I think if you read the full text carefully, this question should be very simple for you.

Decoding: Direct use

Alert (XXX), console (XXX), document.write (XXX) can be (XXX is encoded content).






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.