Hacking an account with XSS and stealing cookies

Lord777

Professional
Messages
2,581
Reputation
15
Reaction score
1,325
Points
113
Hello to everyone, dear friends!
It is possible that for many of you the title of the article is not clear. Don't worry, we'll figure it out now!

What it is?
XSS attack or cross-site scripting is the injection of malicious code into the system server and exploitation of the vulnerability in order to obtain personal data.

In total, there are two types of attacks that I have met in practice:
  • Passive - the participation of the user is required. It must be forced to follow the malicious link in order to initiate the code injection process. It is not easy to do such a thing, it requires knowledge in programming and psychological preparation.
  • Active - you will need vulnerabilities from web resource filters. Using various combinations of symbols and tags, you need to create a request that the site will understand and execute.

The essence of scripting is that the embedded code uses the user's authorization on the website and receives all his personal data.
For a long time, programmers considered XSS to be harmless, not dangerous for servers. Protection was not given much attention. But in vain, now this is one of the most dangerous methods of hacking.

I will also mention stealing cookies, this method is often used by hackers, so it would be unfair to leave it unattended.

Cookies are a small piece of data that a web server sends to a user's PC. Each time a website page is opened, an HTML request is sent to the web server.

Many people believe that Cookies are special programs. But this is not the case. These are ordinary text files with a set of characters, symbols and tags.

I will tell you about the types of cookies that I use myself:
  • First, I apply it during the current session. They are deleted at the end of the specified time period.
  • Second, these files remain forever, they are not deleted. Stored on your hard drive. Under the guise of an ordinary user, hackers use them to decrypt.

What vulnerabilities would I recommend using?
It is unlikely that a clear classification can be distinguished here, but we will divide them into two types:
- Reflected (Impermanent). I would say this is the most common type in use today. You can find them in the parameters of the request or HTML form.
- Stored (Persistent). Such vulnerabilities are used for the most destructive attacks. This requires injecting malicious code into the server. Each time entering the browser, the user will return to the original page.

Of course, if possible, it is better to use stored.

How to apply?
How can we use this information in practice? I will share with you my personal experience.

XSS vulnerabilities.
At the XSS attack is the kernel - it is such a loophole in the filter, which is a must to discover. There are several of them:
- Worms;
- Various web filters;
- Encryption;
- Tags;
- Brackets - open and closed. By type: “/?, #” >>>> << script {()});
- Filtering symbols and signs.


Cookie theft
How do you get someone else's information? Use interception! This is the most common use case for the vulnerability.

What do cookies contain?
  • Login: Password;
  • Valuable contact information;
  • Virus for active session seizure.

Users should be wary of such things. After all, stealing data is not a very pleasant thing. There are special programs for minimal protection that anyone can download and install. But in reality, of course, few people think about online security.

Cookies are used to store data for the user, as well as:
  • Site authentication;
  • Saving settings and personal data;
  • Creation of user statistics and accounting;
  • Monitoring the states of access sessions.
Cookies are very easy to intercept and replace during transmission. Especially if you are using an unencrypted connection to the server.

How can they help?
Crackers use cross-site scripting and cookie theft to gain valuable insights.

What exactly does the exploitation of web vulnerabilities give us?
  • Access to any account on a social network, messenger or dating site;
  • Account login data - login and password;
  • The ability to make changes to the appearance of the page;
  • Access to the clipboard.

Cookies are very important, they are used for identification on the site. You can use your data if you know the cookie. It's easy to read them. You need to execute Javascript on the owner's pc. Javascript can go to any http server and load the image from there. In a request to upload an image, the text is transmitted. So cookies can be in this request and pass into the hands of an attacker. But for this you have to find a hosting with php.

By the way, if you are going to search for XSS vulnerabilities, do it in the Internet Explorer, this standard browser is best suited.

I hope this article helped you in choosing a way to hack a private page. All the information presented is not just theory. It has been tested in my practice more than once in the course of work.

Thank you for reading to the end, dear friend!
 

Hacker

Professional
Messages
1,046
Reputation
9
Reaction score
743
Points
113
91d2b78d5464ef6a6e6cb.gif


What does XSS mean?
XSS (English Cross-Site Scripting - "cross-site scripting") let's look at the official explanation of what it is. XSS is a type of attack on web systems (sites, servers) that involves injecting malicious code into the issued web system (most often Javascript, which will be activated by the user when they open this page or activate the code by a hacker) and interacting this code with the attacker's web server. It is a type of "code injection" attack. In short XSS is the code in our apps

2f61f55722c95d596ec22.jpg


What do they look like?

There are 2 types of XSS attacks:
  1. Stored (Passive)
  2. Reflected (Active)

Stored XSS Attacks
This form is quite simple in practical explanation: a hacker on your site in any field where he can enter the necessary code in JS (Javascript), for example

ed7f4cb295a37e653da5c.png


And we have a typical user and he somehow interacts with this code, let's say he clicks on this field and he activates JS and thus he intercepts the browser impression(cookies, passwords, logins, browser history, ip address, full browser data) of the user.

But social engineering and psychology are already being used, for example, an important letter from the site administration or a letter like " You are the winner, follow the link to get your prize”. Accordingly, you need to know the address or just arrange a spam newsletter or post a post on some popular forum, and it's not even a fact that the victims will be naive and follow your link, but as I said, this is a stage of social engineering and psychology.

Moreover, both POST and GET parameters can be affected by passive vulnerability. With POST-parameters, of course, you will have to go to tricks. For example, redirects from an attacker's site(this is when you click on a link like https://www.google.com, and go to the hacker's site.

Reflected (Active)
Active XSS attacks are more dangerous, since the user does not even need to interact with the js script to activate it, the hacker himself activates it and the user will have the same data stolen as in a passive attack

It can be infected or introduced, for example, by using SQL Injection. Therefore, you should not trust the data stored in the database, even if it was processed during insertion.

Let's look at what can be stolen and how dangerous it is for us.

Cookie Theft
fd04dfc4f75e56082fe8e.png


This is the most frequently cited example of theft using an XSS attack. In cookies, sites store some valuable information ( even the username and password or user hash), but the most dangerous is the theft of an active session( the same button on remember me sites), so do not forget to click the "Log out" link on sites, even if it is a home computer and you are sure that nothing like this has happened to you. Fortunately, most resources have a limited session lifetime.

Stealing data from forms
80f78cb94a81a87528c30.png


We search for the form using, for example, getElementById and track the onsubmit event. Now, before submitting the form, the entered data is also sent to the attacker's server, that is, all the entered data, for example, from a bank card, was transferred to the site where you entered it to the attacker. It is almost impossible for the user to track this.

This type of attack is somewhat similar to phishing, only it does not use a fake site, but a real one, which causes more confidence in the victim. For a user, it is difficult to think of a more dangerous data theft.

DDoS attack
29f4d98e8a72ae2812902.png

An XSS vulnerability on highly visited resources can be used to conduct a DDoS attack. The bottom line is simple - there are a lot of requests that the attacked server can't handle.

That is, the XSS vulnerability will give way to a DDoS attack, which makes it possible to control the site, since after a DDoS attack, the server on which the site is located is restarted and you can take it under control, as well as the data that was on it.
 
Top