Computer >> 컴퓨터 >  >> 프로그램 작성 >> HTML

WordPress XSS 공격:방지 방법

워드프레스 XSS 또는 교차 사이트 스크립팅 공격은 오늘날 웹에서 가장 일반적인 해킹 메커니즘입니다. 그들은 정보를 훔치려는 웹 사이트 방문자를 대상으로 합니다. XSS 공격의 최악의 부분은 공격자가 WordPress 웹사이트의 취약점을 사용하여 이를 수행한다는 것입니다.

WordPress 방화벽을 설치하여 방문자를 XSS 공격으로부터 보호하십시오.

표면적으로 XSS 공격은 특히 무차별 대입 공격이나 SQL 주입과 같은 다른 공격과 비교할 때 그다지 위협적이지 않습니다. 크로스 사이트 스크립팅 공격은 JavaScript를 사용하여 수행되며 JavaScript는 브라우저에서 엄격하게 제어됩니다. 따라서 사람의 나머지 장치에 대한 액세스가 매우 제한적이어야 합니다. 그것이 사실이지만 그것이 덜 위험하다는 의미는 아닙니다.

WordPress XSS 공격은 더 피해를 주는 공격의 관문이며 그 자체로 위험한 것으로 취급되어야 합니다.

틀;DR: MalCare로 해커가 방문자의 데이터를 훔치는 것을 막으십시오. MalCare에는 해커가 웹사이트에서 XSS 취약점을 악용하는 것을 방지하는 통합 WordPress 방화벽이 있습니다. MalCare는 완전한 WordPress 보안을 위해 스캐너, 클리너 및 방화벽을 함께 번들로 제공하는 완전한 보안 플러그인입니다.

WordPress XSS 공격이란 무엇입니까

크로스 사이트 스크립팅 공격인 WordPress XSS는 공격자가 웹사이트에 악성 JavaScript 코드를 삽입하는 것입니다. 방문자가 해당 웹사이트를 방문하면 브라우저가 코드를 실행합니다. 악성 스크립트는 신뢰할 수 있는 출처(이 경우 웹사이트)에서 온 것으로 가정합니다.

XSS 공격은 웹사이트에 크로스 사이트 스크립팅 취약점이 있기 때문에 가능합니다. 취약점은 웹 사이트가 먼저 유효성을 검사하거나 확인하지 않고 생성하는 출력에서 ​​외부 입력을 사용한다는 것입니다.

기술적으로 관심이 없는 사람들에게는 그 설명이 상형 문자로 되어 있을 수도 있습니다. XSS의 작동 방식을 이해하기 위해 비기술적 비유를 살펴보겠습니다.

당신이 ABC 회사와 일하고 있다고 잠시 상상해보십시오. 그들은 당신이 해야 할 작업이 담긴 폴더를 당신에게 건네줍니다. 폴더가 ABC에 의해 컴파일되었음을 신뢰하고 그것을 읽고 작업을 시작합니다. 그러나 ABC 회사가 작업 폴더를 공개된 상태로 두고 누구나 들어와 폴더에 페이지를 삽입할 수 있다고 가정합니다. 논리에 따르면 그렇게 해야 하지만 ABC는 삽입된 페이지를 확인하지 않습니다. 대신, 그들은 당신에게 직접 폴더를 건네줍니다. ABC에 속하기 때문에 폴더를 신뢰할 수 있다고 가정합니다.

그러나 공격자는 잘못된 지침이 있는 페이지를 폴더에 삽입했을 수 있습니다. ABC는 그것이 나쁜지 모르고, ABC에 속하기 때문에 좋다고 생각하고 진행합니다. 좋은 점과 나쁜 점을 구분할 수 있지만 브라우저는 할 수 없기 때문에 이것은 분명히 단순한 비유입니다. 편지의 지시를 따릅니다.

워드프레스 XSS 공격의 결과

XSS 공격의 주요 대상은 웹사이트 방문자 또는 보다 구체적으로 해당 정보입니다. 따라서 XSS 공격이 성공하면 악성 스크립트가 귀하의 웹사이트가 액세스할 수 있는 방문자의 브라우저에 있는 모든 정보에 액세스할 수 있습니다. 여기에는 쿠키, 세션 정보 등이 포함됩니다.

이 단계에서 많은 일이 잘못될 수 있습니다.

  • 해커는 방문자의 개인 데이터에 액세스하고 웹사이트에서 방문자의 계정을 탈취할 수 있습니다. 이 시점부터 상황이 빠르게 확대될 수 있습니다.
  • 해커는 방문자의 데이터에 액세스할 수 있으므로 방문자를 가장할 수 있습니다.
  • 악성 스크립트는 방문자를 다른 웹사이트로 보내거나 방문자가 방문한 원래 사이트가 아닌 콘텐츠를 표시할 수 있습니다. 악성 스크립트는 브라우저에 페이지가 표시되는 방식까지 변경할 수 있습니다.
  • 정말 나쁜 경우 공격자는 피싱과 같은 사회 공학적 공격으로 방문자를 표적으로 삼을 수 있습니다.

웹사이트의 경우 WordPress XSS 공격의 영향은 다양할 수 있습니다. WordPress 웹 사이트는 해커가 훔칠 수 있는 개인 사용자 데이터를 저장할 때 심각한 문제에 빠질 수 있습니다. 문제의 사용자가 관리자이거나 충분한 권한을 가진 사람이면 해커가 사용자를 가장하여 웹사이트를 완전히 손상시킬 수 있습니다.

웹사이트에 WordPress XSS 취약점이 있는지 확인하는 방법

XSS 취약점은 코드에 존재합니다. WordPress 핵심 코드 또는 플러그인 및 테마. 웹사이트에 대한 사용자 지정 코드를 개발하지 않는 한 사용자 입력을 직접 처리할 가능성은 낮으므로 보안을 유지하는 방법을 찾는 것은 귀하의 범위에 속하지 않습니다.

WordPress 웹 사이트가 XSS 공격에 취약한지 확인할 수 있는 유일한 실제 방법은 XSS Hunter와 같은 스캐너를 사용하거나 침투 테스터의 서비스를 고용하는 것입니다.

그러나 이것이 웹사이트의 잠재적인 XSS 취약성으로부터 웹사이트 방문자를 보호할 수 없다는 것을 의미하지는 않습니다. WordPress 방화벽을 설치하면 공격을 방지하고 방문자를 보호하는 데 많은 도움이 됩니다.

또한 설치된 플러그인 및 테마에 대한 탭을 유지할 수 있습니다. 그들 중 하나라도 XSS 취약점을 공개하는 경우 가능한 한 빨리 업데이트해야 합니다. MalCare는 매일 귀하의 웹사이트를 스캔하기 때문에 이를 쉽게 만듭니다. 취약한 플러그인이나 테마가 발견되면 MalCare 대시보드에서 안전하게 업데이트할 수 있습니다.

XSS 익스플로잇 공격이 웹사이트에 맬웨어를 가져오면 어떻게 될까요?

사이트 방문자는 표면상 XSS 공격의 대상이지만 해당 그룹에는 웹 사이트 관리자도 포함될 수 있습니다. 웹 사이트에 사이트 간 스크립팅 취약점이 있고 관리자 계정이 손상된 경우 웹 사이트 보안도 손상되었다고 가정해야 합니다.

개인의 데이터를 훔치는 것 외에도 XSS 공격은 원격 코드 실행과 같은 다른 공격을 영속화하는 데에도 사용됩니다.

따라서 WordPress XSS 공격이 즉시 맬웨어로 변환되지 않더라도 주의를 기울이는 것이 좋습니다. 웹사이트에 맬웨어가 있는 경우 즉시 처리하십시오.

웹사이트 스캔

웹 사이트에 실제로 맬웨어가 있는지 확인하는 유일한 방법은 검사하는 것입니다. 이 작업을 수행할 수 있는 몇 가지 방법이 있지만 모든 방법이 동일하게 효과적인 것은 아닙니다.

WordPress XSS 공격:방지 방법

보안 스캐너로 웹사이트를 자세히 스캔하는 것이 좋습니다. 웹사이트나 데이터베이스에서 가장 작은 맬웨어 흔적을 찾기 위해 이것은 웹사이트에 맬웨어가 있는지 확인하는 확실한 방법입니다. 답을 찾으면 해킹된 WordPress 사이트 처리에 대한 가이드에 따라 제거할 수 있습니다.

WordPress XSS 보호:XSS 공격을 방지하는 5가지 방법

WordPress Cross-site scripting 취약점은 코드에서 발견되며 WordPress 관리자가 이러한 취약점을 제거하기 위해 할 수 있는 일은 거의 없습니다. 그러나 XSS 공격으로부터 사이트 방문자를 보호하기 위해 할 수 있는 일이 분명히 있습니다.

WordPress XSS 공격:방지 방법

1. 웹 응용 프로그램 방화벽 설치

방화벽은 끊임없이 진화하는 위협에 맞서는 최고의 방어 수단입니다. 방화벽에는 일반적으로 XSS 공격에서 발견되는 의심스러운 텍스트가 포함될 수 있는 요청을 찾는 특수 규칙이 있습니다.

추천 읽기:WordPress에서 국가 IP 주소를 차단하는 방법

2. 모든 플러그인 및 테마 업데이트

WordPress 보안 취약점은 플러그인과 테마에서 항상 발견됩니다. 책임 있는 개발자는 웹사이트가 위험에 노출되지 않도록 보안 패치를 출시합니다. 패치가 제공되면 취약점을 발견한 사람들이 뉴스를 발표합니다. 따라서 플러그인과 테마를 업데이트하지 않은 웹사이트는 해커의 표적이 됩니다.

3. 좋은 WordPress 보안 플러그인 설치

XSS 공격은 대상 사용자가 관리자인 경우 웹사이트 소유자에게 정말 위험합니다. XSS를 사용하여 로그인 자격 증명을 얻은 다음 웹 사이트를 맬웨어로 감염시킬 수 있습니다. 좋은 보안 플러그인은 비정상적인 활동에 대해 사용자를 모니터링하는 데 도움이 되며 일일 검사는 모든 맬웨어를 빠르게 찾아냅니다.

4. WordPress 강화 구현

WordPress 강화는 일반적으로 WordPress 사이트를 보다 안전하게 만들기 위해 수행할 수 있는 일련의 단계입니다. 이 중 특히 이중 인증을 권장합니다. XSS 공격의 가장 큰 위험은 로그인 자격 증명 및 ID 도용이므로 2단계 인증은 도난당한 자격 증명이 사이트에 액세스하는 데 사용되는 것을 방지하는 데 큰 도움이 됩니다. XML-RPC 비활성화와 같은 다른 강화 단계도 구현하는 것이 좋습니다.

5. 최소 권한 사용자 정책 준수

XSS 공격으로 인해 사용자 계정이 손상된 경우 웹사이트에서 사용자의 권한에 따라 사용자가 잠재적으로 입을 수 있는 피해가 제한됩니다.

WordPress 개발자라면 항상 사용자 입력을 삭제하십시오. 웹사이트는 특히 출력으로 표시하기 전에 모든 입력에 악성 코드가 있는지 확인해야 합니다.

워드프레스 XSS 공격 작동 방식

XSS 공격은 주입과 낙진의 두 부분으로 작동합니다.

첫째, 해커는 악성 자바스크립트 코드를 취약한 웹사이트에 주입합니다. 이것은 다음 섹션에서 논의할 몇 가지 방법으로 수행할 수 있습니다. Next, when a visitor lands on the site, the browser executes the malicious JavaScript code because it thinks it is part of the website.

The consequence of this is that a hacker now has access to all the visitor’s data that is visible to the website. This might include their cookies, session information, and login data. The information can be used to launch other attacks like phishing or cookie stealing.

What does this have to do with your WordPress website?

At this point, it looks like the problem lies with the visitor and their browser. However, that is not accurate. The browser would not execute the malicious code unless it thought it was a part of a trusted website. If the visitor is on your site, the trusted website is yours.

The XSS attack works because a website needs to have an XSS vulnerability. That means it should accept user input without checking or validating the input in any way. Only then does WordPress XSS exploit allow an attacker to inject JavaScript into the website without a problem.

Let’s look at an example.

On a WordPress blog, the admin wants to be able to allow readers to post comments under articles. The admin installs a plugin to manage said comments.

When a reader wants to post a comment, they type it into a text field, which has been provided by the plugin. Anyone can type up their comment and send it to the website database. 여태까지는 그런대로 잘됐다.

The problem appears when someone who is not-so-nice types up a comment, but adds a script to it as well. The input would be something along the lines of:“This cake recipe is superb! The script tags enclose JavaScript code that is malicious and designed to interact with other visitors to the site.

The plugin doesn’t check the comments for these scripts, assuming that it is all text. And then saves it, as is, to the database. This is an XSS vulnerability.

Now, another visitor comes to the blog page, and their browser loads the page and the comments. The website database has saved all the comments, and so sends it to the browser so the new visitor can see them. But because there is JavaScript in one of the comments, the browser thinks that bit of code needs to be executed. And it does that, assuming the code is a part of the website. But it wasn’t. The website thought the code is text, and has saved it as such. The browser sees a script and executes it. This is how an XSS attack works.

If the plugin checked the comments for malicious code before saving them to the database, the website wouldn’t have the XSS vulnerability. The browser wouldn’t receive the JavaScript code, and the visitor’s data would be safe.

Types of cross-site scripting attacks

Cross-site scripting attacks are categorised depending on where the code is stored and executed. There are 3 main types of attacks:stored or persistent, reflected, and DOM . However, they are not mutually exclusive. XSS attacks can be a combination of these types. It is still useful to understand these types though, and see how they intersect with each other.

  • Stored XSS: In our comment example of the previous section, the comment was sent to the website database and stored there. Then, when a visitor comes along, it is sent to their browser. Because the code is stored on the database, it will be sent to all visitors. That’s why it is called stored or persistent XSS.
  • Reflected XSS: Reflected XSS attacks are a little tricky to understand, because it involves the visitor sending the malicious code to the website themselves, albeit unwittingly.

    An attacker sends your website link to your visitors, typically via email or a neutral website. The link contains malicious code though, so when the visitor clicks on it, it sends that code to your website. If your website has an XSS vulnerability, it means that your website isn’t checking user input like this for malicious code. So when your website sends the response back to the visitor’s browser, it includes the malicious code as well. The visitor’s browser now thinks that the code is part of your website, and executes it. And thus the attacker has access to the visitor’s information.

In both stored and reflected XSS attacks, the website is involved in the attack. The malicious code actually goes into the web server or database, and is sent back to the visitor. The only difference is whether the attacker sends it to the website or the visitor themselves.

  • DOM-based XSS: In the case of DOM-based XSS, the code is not sent to the website at all. The malicious code can be sent to the visitor like in a reflected XSS attack, but instead of being sent to the website at all, it is executed by the browser directly.

    This may seem like this isn’t a vulnerability on the website at all, but it is. The malicious script isn’t sent to the website, but remains in the visitor’s browser. The visitor’s browser sends a request to the website server. The server response uses user input which is already in the browser. Which in this case is malicious code.

To understand types of XSS attacks better, check out this dedicated resource.

That being said, the types of XSS attacks shouldn’t be of concern to you, because there is little you can actively do to resolve Cross-site scripting vulnerabilities. It is not feasible to vet plugins and themes to see if they have these vulnerabilities before they are discovered after all. However, once they are discovered, you should update them right away.

You can protect your website visitors from Cross-site scripting attacks by installing a firewall. This is the only real defense against malicious code.

Takeaways

A wordPress XSS attack is very common and they target website visitors to steal data. As a responsible website admin, you want to protect your visitors from harm. Installing a WordPress firewall will go a long way in doing that. MalCare is a sophisticated WordPress firewall, and a great security plugin. The vulnerability and malware scanner helps mitigate the ill effects of malware quickly and effectively.

Also Read:Prevent Cross-site Scripting attacks

FAQs

Is WordPress vulnerable to XSS?

Yes, WordPress is vulnerable to XSS attacks. There are many XSS vulnerabilities discovered in the WordPress core files, in addition to the plugins and themes. Responsible developers resolve these WordPress XSS vulnerabilities quickly and update their software so it cannot be exploited by hackers.

What does cross-site scripting mean?

Cross-site scripting (XSS) is a cyberattack that uses malicious scripts on your web browser to hack browser session cookies to steal highly sensitive data. Used effectively, cross-site scripting can steal passwords and financial information. WordPress XSS hacks are very difficult to defend against unless you use a powerful firewall.

How to Prevent XSS in WordPress?

The simplest way to defend against XSS attacks in WordPress is to install a firewall that can effectively block out malicious traffic. For WordPress, we also recommend hardening your website against typical hacks.