Skip to content

SafeDNS Recognized as the Must-Have IT Tools for IT Professionals

GetApp, an established software review, and recommendation engine, featured SafeDNS in its “10 Must-Have IT Tools for IT Professionals” report. With an overall rating of 4.7,SafeDNS was mentioned as one of the Must-Have IT Tools for IT Professionals with an overall positive rating of 97%.

Not only this, SafeDNS is a winner of not 1 but 2 GetApp Category Leaders reports in the first half of this year! Check out our incredible win:

SafeDNS has been a top-rated product on GetApp. Our users have made it possible! Check out our performance on GetApp –

Here’s what our users have to say about us:

“SafeDNS is a really great product, we have been using it for over 5 years now and it’s really robust. We deploy for all our customers internal networks and this includes our Azure infrastructure and it just works.”

Jason T.

“We have been using this software for years and are very happy with the results. School and Parents are grateful for the safety this software brings to us. When I check our stats and can see the protection that is being provided. Makes us very happy.”

Ruth P.

Want to review SafeDNS? Click here.

About Version 2 Digital

Version 2 Digital is one of the most dynamic IT companies in Asia. The company distributes a wide range of IT products across various areas including cyber security, cloud, data protection, end points, infrastructures, system monitoring, storage, networking, business productivity and communication products.

Through an extensive network of channels, point of sales, resellers, and partnership companies, Version 2 offers quality products and services which are highly acclaimed in the market. Its customers cover a wide spectrum which include Global 1000 enterprises, regional listed companies, different vertical industries, public utilities, Government, a vast number of successful SMEs, and consumers in various Asian cities.

About SafeDNS
SafeDNS breathes to make the internet safer for people all over the world with solutions ranging from AI & ML-powered web filtering, cybersecurity to threat intelligence. Moreover, we strive to create the next generation of safer and more affordable web filtering products. Endlessly working to improve our users’ online protection, SafeDNS has also launched an innovative system powered by continuous machine learning and user behavior analytics to detect botnets and malicious websites.

Ethics and Morally Ambiguous Security Pursuits

Most cybersecurity professionals understand moral ambiguity. Just ask Marcus Hutchins, the “accidental hero” who stopped the WannaCry ransomware attack in its tracks.

Hutchins was working as a security researcher when he discovered a critical flaw in the malware — its kill switch. Not long after, he was indicted on federal charges related to his previous work as a malware developer on HackForums – a bustling collective of young hackers.

Thankfully, Hutchins was eventually cleared of all charges. But his story highlights the murky ethical landscape that many security researchers operate in.

On one hand, companies and individuals are better off when security researchers find and disclose vulnerabilities. On the other hand, some researchers find – or develop – exploits to sell on the dark web. For budding cybersecurity researchers, it’s not always clear where the line is.

After reading Hutchins’ story, I thought a lot about the nature of communities. Communities in the Internet age, specifically, and how they can lead us to the best things the Internet has to offer, or to the worst corners of others’ minds.

Take YouTube, for instance – its algorithm is designed to serve content that pushes users deeper into a specific topic, often toward morally questionable content. The same is true of TikTok, Facebook, and a slew of others. This subconscious manipulation is one of many reasons why it’s so difficult to find a like-minded community where you can collaborate and learn.

Hutchins didn’t need an algorithm to push him into the dark side. He found it while poking around a young hacking forum. Pretty soon, he would go from admiring malware to building his own, with increasingly dark results. Eventually, Hutchins built his own community, amassed followers on the order of tens of thousands, and attracted the attention of Kryptos Logic. And thus began his white-hat path toward neutering WannaCry.

“There’s [a] misconception that to be a security expert you must dabble in the dark side,” said Hutchins. “It’s not true. You can learn everything you need to know legally. Stick to the good side.”

I can only wonder how much more good Hutchins could have done had he found the “good side” long ago. Or, how much good current black-hat hackers could accomplish with encouragement from the right community.

The Modern Security Researcher’s Tribe

In the early days of hacking, only a handful of people could exploit vulnerabilities and gain unauthorized access to systems. These individuals were self-taught, like Hutchins, and their skills were not widely known or understood. As the Internet grew, more and more people became interested in hacking culture, sharing their knowledge and developing new techniques.

It’s a constantly evolving field.

Researchers used to be seen as “lone wolf” operators, working in isolation to scratch an intellectual itch. But the cybersecurity profession has undergone a dramatic transformation in recent years. Today’s security researcher is less likely to be a lone wolf and more likely to be part of a team, working together to uncover critical vulnerabilities and exploits (CVEs) and develop solutions. They are also more likely to use sophisticated tools and techniques to find vulnerabilities in systems. And thanks to the power of the Internet, they can reach a global audience with their findings.

This shift has been driven by the increasing complexity of attacks, which require greater levels of expertise to defend against. Security research is now an essential part of the modern IT landscape, and it is only going to become more important in the years to come.

One thing is certain, though: The work of security researchers has a profound impact on society. They are the ones who find the vulnerabilities that can be exploited to cause massive damage – like WannaCry. But the vulnerabilities they find could just as easily end up in the hands of bad actors who are intent on ripping off people and/or harming critical infrastructure.

The job is a delicate balancing act, one that requires a great deal of responsibility.

It’s important to remember that security researchers are not immune to the same biases and motivations that affect everyone else. They need support, and people to hold them accountable when they come across that ethically dubious line.

There’s no question that security research is a vital part of keeping our online world safe. But where do these researchers thrive? In what types of environments do they do their best work?

For many security researchers, it’s all about the community. It’s here where groups of like-minded individuals share information and ideas. And there are numerous online forums and newsletters where they can share ideas, debate techniques, and collaborate. In addition, there are conferences and in-person meetups to discuss the latest trends and challenges.  

By working together, they can pool their knowledge and resources, making it easier to identify and neutralize threats. In addition, the security research community provides a supportive environment for new researchers, helping them to develop the skills and knowledge that they need to be successful.

Today, the security research community is vast and diverse. It includes individuals from all walks of life, with varying levels of expertise. Some security researchers are full-time professionals, while others are hobbyists or students. But regardless of their background or experience, they all share one common goal: to find and report CVEs. That’s why we developed vsociety – for security researchers to share CVEs and gain communal support.

Of course, not all security researchers need or want to be part of a community. Some prefer to work independently, researching new vulnerabilities and developing innovative new solutions to exploits. For these researchers, the lack of community involvement can actually be a benefit, as it allows them to focus entirely on their work as they see fit. And, for that matter, not every community offers consistent, genuine support.

Take Twitter, where many security researchers gravitate due to a lack of good online communities. Twitter can be a great source of support, but it can also be a breeding ground for new threats. In recent years, we’ve seen several cases of hackers on Twitter developing and releasing malware that caused real-world damage.

Yes, social media intelligence can be a valuable asset for gathering insights on threats or contextualizing current research. But the information found on Twitter needs a thorough scrubbing for veracity and reliability.

Why? Because Twitter is rife with fake news and content disguised to harm organizations or people. The proliferation of misinformation requires security researchers on Twitter to always use keen judgment. But some activities on social media can fall in a gray area; meaning they may be illegal in certain jurisdictions but do not violate Twitter’s terms of service. If a security researcher runs with such information, they could be compromised..

Indeed, it’s more important than ever to find a cybersecurity community that nurtures “good faith” vulnerability hunting. After all, we’re on the verge of the new age in security research…

A New Catalyst for Good Emerges

Security researchers work tirelessly to find vulnerabilities in software and systems, and they report these bugs to the appropriate parties so they can be patched. Many of these researchers also participate in bug bounty programs, which offer rewards for finding and reporting security vulnerabilities. In other words, they get paid to hack systems and find weaknesses. Without security researchers, we would be living in a much less safe and secure world.

While bug bounties can be a great way to crowdsource security testing and build goodwill with the bug-hunting community, it can also be great for adding a misdemeanor (or worse) to your record. The good news is that the U.S. Justice Department recently directed prosecutors not to go after hackers under the Computer Fraud and Abuse Act (CFAA). But only if their reasons for hacking are ethical. Ethical reasons include bug hunting, disclosing CVEs responsibly, and above-board penetration testing.

This is huge news.

While some believe the new policy doesn’t go far enough to protect individual bug hunters, it does provide more freedom for security researchers to find and report CVEs without the fear of legal repercussions. Still, individual security researchers must mind the ethical gap. If they unwittingly cross a muddled line (made even more indecipherable by the policy’s bureaucratic speak), they could be met with legal consequences—making it all the more important for security researchers to learn how to apply caution and ethics in their bug hunting.

A Tribe Called Home

“In my career I’ve found few people are truly evil, most are just too far disconnected from the effects of their actions,” wrote Marcus Hutchins. “Until someone reconnects them.”

A good community – if it does its job well – can reconnect even the most ethically disconnected individuals. But it’s essential for everyone – from individuals to companies to government agencies – to do their part to improve cybersecurity. Whether it’s investing in better security tools or simply being more careful about what information is shared online, we all have a role to play. Our role is in building a community that security researchers may turn to for education, collaboration, and thought leadership.

As technology advances, so must the methods used to protect our data. Cybersecurity professionals are constantly working to stay ahead of hackers by developing new security measures and techniques. At the same time, security researchers are working just as hard to identify potential vulnerabilities in these systems so that they can be addressed before they can be exploited. As security professionals, we are constantly trying to stay ahead of the latest threats and vulnerabilities. We need to be able to quickly identify attacks, respond to them, and prevent them from happening again. To do this, we rely on security researchers who help us understand how attackers operate and what new techniques they are using. It is a never-ending race, but it is one that is essential to the safety of our digital world. And in today’s digital landscape, community plays a pivotal role in driving security researchers toward “good faith” vulnerability hunting.

There will be plenty more people like Marcus Hutchins. Some of whom discover the “dark side” and transition over to the “good side.” And others who discover the “dark side” and remain. With positive support from the right community, we can better steer the Marcus Hutchins’ of this world over to the good side of security research.

#security #community #ethics #hacking #hackers

About Version 2 Digital

Version 2 Digital is one of the most dynamic IT companies in Asia. The company distributes a wide range of IT products across various areas including cyber security, cloud, data protection, end points, infrastructures, system monitoring, storage, networking, business productivity and communication products.

Through an extensive network of channels, point of sales, resellers, and partnership companies, Version 2 offers quality products and services which are highly acclaimed in the market. Its customers cover a wide spectrum which include Global 1000 enterprises, regional listed companies, different vertical industries, public utilities, Government, a vast number of successful SMEs, and consumers in various Asian cities.

About VRX
VRX is a consolidated vulnerability management platform that protects assets in real time. Its rich, integrated features efficiently pinpoint and remediate the largest risks to your cyber infrastructure. Resolve the most pressing threats with efficient automation features and precise contextual analysis.

Log4Shell: How to Mitigate Log4j Vulnerability (CVE-2021-44228)

In the end of 2021, the whole digital world has suffered the new cybersecurity flaw named Log4Shell. A new vulnerability is considered to be one of the worst that have been discovered during the last years. It scored 10 out of 10 points on the CVSS vulnerability rating scale, and it puts countless servers at risk.

What is Log4Shell?

On December 9th, a critical vulnerability that allows arbitrary code to be executed was discovered. The exposure got the code CVE-2021-44228.

The Log4Shell is a vulnerability in the open-source logging library, Log4j version 2, which is used by millions of Java-based applications/servers to log error messages. Such digital giants as Tesla, Twitter, Apple iCloud, Amazon, and millions of other companies use the Log4j library.

There is a lookup substitution function in the Log4j library. Log4Shell vulnerability exists because lookup substitutions are not protected enough when dealing with user-controlled input. Unauthenticated users can exploit this vulnerability via a web request to execute arbitrary code with the permission level of the running Java process.

The first worldwide famous target was Minecraft. On December 10th, people started sharing videos showing that, while playing online, they could just insert code to chat on the server and seize power over the server. But most likely, everything started earlier. Cloudflare -Content Delivery Network and DDoS mitigation services provider – checked their systems and noticed that the first attack on their clients with Log4Shell vulnerability had been tried to conduct on December 1st.

What makes Log4j uniquely dangerous even though you seem protected

Exploiting Log4Shell vulnerability allows hackers to launch Remote Code Execution (RCE) and remotely take full control of the victims’ systems. Hackers are already actively exploiting this vulnerability. For the last week, Ransomware groups weaponized their toolset with this exploit and are using it to disrupt normal businesses operations, exfiltrating data & making affected servers unavailable for customers.

One more point which makes Log4Shell as dangerous as it is the simplicity of exploitation. Even “junior” hackers can use this exploit. To gain control over the victim’s system, a hacker inserts the code anywhere this library handles – fill the form the website, modify website URI or Browser user-agent, or text in the support chat – and it will lead to code execution.

The whole java-world is trying to deal with Log4Shell and emphasize that it is the highest possible priority for all-sized businesses. Cisco, Apple iCloud, Microsoft, and so many other huge technology companies have already stated that some of their systems were vulnerable, but they are fixing it. But for small-sized companies without a cybersecurity department, it might be quite hard to mitigate the attack independently.

Which Version is not affected?

Almost all versions of log4j version 2 are affected. On December 14th, version 2.15 was found to still have a possible vulnerability. And a few days later, a Denial of Service (DoS) vulnerability was found in 2.16 too. The developers have already prepared version 2.17 and, as of December 20th, recommend updating the library again.

How to Mitigate the Log4Shell Vulnerability? First aid actions

Put a high priority on your IT/DevOps on patching/mitigating this vulnerability. This is worth immediate effort.

Update

It was previously thought that to be not vulnerable to Log4Shell, it is enough to turn off the lookup substitution function. But after a few days, it came across that it doesn’t work like that. Generally, the main action now (on December 20th) is to update the Log4J library to 2.17, which is supposed to be safe and has lookups turned off.

“To my satisfaction, our programs are not written in Java,” – you might think. But the point is that you may have hundreds of different systems, and they most likely are not developed by the inside team but developed by third parties – as it usually occurs. Therefore, you might not even know what is inside these systems. In this case, you should look at the product’s website or contact support for instructions on what to do to be safe.

Constant Security Monitoring

Log4Shell vulnerability is one of many, critical vulnerabilities that were found during the past ten years. And the situation is constantly evolving. The only way to see what is happening inside your system is to have 24×7 security monitoring and threat remediation and response. It will help you identify your vulnerable internal and external assets, patch production, review your log files for any Remote Command Execution attempts. Security analytics can see attempts to exploit Log4Shell vulnerability in the logs and block them*.

*Only in one client, the UnderDefense Managed Detection and Response team blocked six attempts to exploit this vulnerability only a week after the vulnerability was discovered.

A firewall is not a panacea

A firewall can block the attempts to exploit Log4Shell vulnerability, but this is not a panacea because the firewall main task is “not to pass such text.” But the exploitation of this vulnerability can vary. Hackers can easily make it so that the text does not match 100%, writing the same code using different methods, but still works WAF bypass. Accordingly, WAF is not enough but still shouldn’t be neglected.

Enable blocking on Web Application Firewall through AWS WAF, Cloudflare, or any other WAF you have, or directly on your web-server, reverse-proxy, load balancer.

Penetration Testing

After remediating this vulnerability with your DevOps team, it is worth running a penetration test to ensure external and internal systems are patched correctly, and other old vulnerabilities are not exploitable. Generally, pentesters will do the same as hackers do – try to conduct an attack on the vulnerable system. But don’t forget about other vulnerabilities that existed before Log4Shell and didn’t disappear. It is the same as having 12 bad teeth, but to treat only 1 of them. So, conducting a pentest, it is better not to choose only one vulnerability test.

Conclusion

Since December 9th, developers have thought that user can just turn off lookups in the Log4J library to fix the vulnerability. But a few days ago came across that this method doesn’t work, and millions of systems still stay vulnerable. Developers told to update the Log4J v2 library to 2.16. And people did it. But recently, the vulnerability was also found in 2.16, and now there is a 2.17 version, which is supposed to be safe.

The situation is evolving. Log4Shell is something new, something dangerous, and something that is not studied enough. We recommend you to have your finger on the pulse and take care of your cybersecurity.

About Version 2 Digital

Version 2 Digital is one of the most dynamic IT companies in Asia. The company distributes a wide range of IT products across various areas including cyber security, cloud, data protection, end points, infrastructures, system monitoring, storage, networking, business productivity and communication products.

Through an extensive network of channels, point of sales, resellers, and partnership companies, Version 2 offers quality products and services which are highly acclaimed in the market. Its customers cover a wide spectrum which include Global 1000 enterprises, regional listed companies, different vertical industries, public utilities, Government, a vast number of successful SMEs, and consumers in various Asian cities.

About UnderDefense
UnderDefense, a globally top-ranked firm by Gartner and Clutch, provides cyber resiliency consulting and technology-enabled services to anticipate, manage and defend against cyber threats. We empower clients to predict, prevent, detect, and respond to threats.

如何確認您的電腦設備可能被駭客入侵

全球網路犯罪分子每年因人們的誤點網路釣魚連結、重要軟體忘記更新以及沒有使用雙重身份驗證 (MFA)等行為而賺取數萬億美元,他們藉由不同的攻擊媒介,竊取帳號資料,或透過各種工具、網路犯罪行為及不法網站等,來取得交易訊息;且潛伏的時間越長,造成的損失就越大,後果可能也就越昂貴,因此,如能越早發現越好,所以主動進行一些確認或檢查也是有其道理的。據FBI指出,去年(2021年)有847,000家企業和消費者遭遇網路犯罪事件,損失金額近70億美元,ESET資安專家提醒千萬不要為時已晚才採取行動。

如果不想成為網路犯罪的受害者,請留意以下十個跡象,代表您的電腦設備可能已被駭客入侵:

1.您收到勒索軟體訊息
最顯而易見的是,當您開機時不是出現一般的啟動畫面,而是看到勒索訊息,那麼您很有可能已成為勒索軟體的受害者了,它通常會給一個很短的支付時限及說明如何支付贖金,但不幸的是,即便您確實遵守了指示,也有三分之一的機會無法重新獲得這些加密文件的存取權限。

2.電腦跑很慢
當惡意軟體(包括特洛伊木馬、蠕蟲和加密貨幣挖礦)植入於電腦設備時,它們通常會使運行變慢,尤其是加密劫持攻擊,它會佔用大量的效能,當然電腦跑很慢不全然是惡意因素所造成,也有可能是電腦設定不佳等問題。

3.視訊鏡頭自行開啟
駭客使用的一些間諜軟體除了可以取得您在電腦設備的資料外,還能偷偷打開視訊鏡頭和麥克風,藉由這樣記錄和竊取您和您家人的視頻,進而用於勒索,所以請密切留意視訊鏡頭,檢查它是否會自行開啟,ESET資安專家建議最好利用貼布貼住,來確保不會使用到它。

4.您的朋友收到來自您電子信箱的不明郵件
還有一個證明您的電腦設備已被入侵的指標是,如果您的朋友和客戶開始收到來自您的不明電子郵件或社交媒體帳戶的垃圾郵件;典型的網路釣魚就是劫持受害者的​​帳戶,然後向他們的所有朋友發送垃圾郵件或網路釣魚。若所有帳戶都有使用雙重身份驗證(MFA)的機制,則可以輕鬆緩解這種威脅。

5. 頻繁地彈出視窗
廣告軟體通常透過受害者接觸過多的廣告量來讓攻擊者賺錢,因此,如果您的電腦頻繁地彈出式廣告,這代表某處可能安裝了一些惡意代碼或可能不需要的軟體。

6.工具列突然出現新的圖標
惡意軟體還可能在您的瀏覽器上安裝其他工具列,如果您發現任何您不認識或不記得下載的內容,則可能意味著您的電腦設備已被駭客入侵;如果您遇到 APT 團體的惡意軟體攻擊,則可能需要將您的電腦設備恢復至出廠設定才能將其刪除,若是PUA (Potentially Unwanted Application,潛在有害應用程式)的話,只要刪除應用程式和工具列就可以了。

7.出現隨機圖標
當惡意軟體安裝在受感染的電腦設備時,通常會出現新的桌面圖標,只要桌面整齊地排列成少量的文件、文件夾和程式,就可以輕易發現。ESET資安專家建議整理一下電腦桌面,以便更好地追踪電腦設備上的圖標。

8.密碼無法使用/無法登錄
如果駭客入侵了您的電腦設備,他們很有可能已經劫持了各種在線帳戶,例如您的電子郵件,並更改了密碼,將您拒之門外,這也是所有網路攻擊中最嚴重的情況之一。

9.個資和登錄資訊在暗網流通
如果您收到與您有業務往來公司之資料外洩通知,請務必嚴肅看待並在可以提供第三方確認任何違規行為,如HaveIBeenPwned之類的網站進行驗證。另外利用暗網監控工具還可以在網路犯罪的相關論壇搜索您的資料,以更主動的方式來了解您的個資和登錄資訊之暗網流通狀況。還有若您能迅速進行更改密碼、凍結信用卡等行為,也可以降低被駭客利用或攻擊的風險。

10.您收到來自防毒軟體的警告
來自反惡意軟體工具的警告也應慎重看待,儘管耳聞有假冒的電腦防毒軟體彈跳視窗,但仍請確認訊息是否來自於您購買的電腦防毒軟體供應商,並按照說明嘗試查找並刪除您電腦設備上的惡意文件。

#若有任何資安需求,歡迎洽詢 Version 2 資安專業團隊,服務電話:(852) 2893 8860 ,或上官網查詢:https://version-2.com/

原文出處:https://www.welivesecurity.com/2022/08/09/howto-check-hacked-pc/

About Version 2

Version 2 Digital is one of the most dynamic IT companies in Asia. The company distributes a wide range of IT products across various areas including cyber security, cloud, data protection, end points, infrastructures, system monitoring, storage, networking, business productivity and communication products. Through an extensive network of channels, point of sales, resellers, and partnership companies, Version 2 offers quality products and services which are highly acclaimed in the market. Its customers cover a wide spectrum which include Global 1000 enterprises, regional listed companies, different vertical industries, public utilities, Government, a vast number of successful SMEs, and consumers in various Asian cities.

關於ESET
ESET成立於1992年,是一家面向企業與個人用戶的全球性的電腦安全軟件提供商,其獲獎產品 — NOD32防病毒軟件系統,能夠針對各種已知或未知病毒、間諜軟件 (spyware)、rootkits和其他惡意軟件為電腦系統提供實時保護。ESET NOD32佔用 系統資源最少,偵測速度最快,可以提供最有效的保護,並且比其他任何防病毒產品獲得了更多的Virus Bulletin 100獎項。ESET連續五年被評為“德勤高科技快速成長500 強”(Deloitte’s Technology Fast 500)公司,擁有廣泛的合作夥伴網絡,包括佳能、戴爾、微軟等國際知名公司,在布拉迪斯拉發(斯洛伐克)、布裏斯托爾(英國 )、布宜諾斯艾利斯(阿根廷)、布拉格(捷克)、聖地亞哥(美國)等地均設有辦事處,代理機構覆蓋全球超過100個國家。

Cross-site request forgery (CSRF)

There is common confusion about the difference between XSS (Cross-site scripting) and CSRF (Cross-site request forgery). 

In performing Cross-site scripting (XSS) attack, an attacker can execute a script within the browser of a victim user. While performing a Cross-site request forgery (CSRF) attack, an attacker can induce a victim user to perform actions they do not intend to.

These are the steps the attacker will perform to hijack the victim’s identity:

  • Persuade a victim with social engineering techniques to click on the link sent in the mail, which will trigger a request to the targeted site. 
  • After going to some website malicious request is triggered, the application will assume that it comes from a signed user. An attacker will perform a requested action without the user’s knowledge or consent.

Purpose of CSRF attack

Target is often to change server state and/or to gain access to sensitive data. When a CSRF attack is successful against the victim’s account, the attacker has the option to transfer funds, purchase a product, modify account settings, or any other action that the signed user could perform.

Example

As I mentioned, the attacker will try to persuade the targeted user to click on the link that will

send the request.

If the attackers were messing with DOM elements, they would use the href tag:

<a href="https://someUrlWithSomeParameters.com">Click for more details</a>

If the application has some filter restriction on navigation, and if the application is using POST requests attacker can try to use the form tag. They would create a form and, with JS, submit the POST request.

I found one simple example of adding a form on site Portswigger, and the code is below.

This example is the hidden HTML form that will, without user knowledge, create a post request. If the user was redirected to another site, this site could contain this hidden form to hijack the user identity.

Code in script tag will trigger submit of the form and send the request.

<html>

    <body>

        <form action="https://vulnerable-website.com/email/change" method="POST">

            <input type="hidden" name="email" value="pwned@evil-user.net" />

        </form>

        <script>

            document.forms[0].submit();

        </script>

    </body>

</html>

What are CSRF Tokens

CSRF tokens are used to protect from CSRF attacks. Tokens are unique and are created as a secret value generated by the server and sent to the client to be included in subsequent HTTP requests created by the client. 

How we prevent CSRF attacks using CSRF tokens

When the HTTP request is made, the server-side validates the request, including the expected token. If the token is missing or invalid, validation will not pass, and the request will be rejected.

So, when an attacker creates a request, it will not pass because the requests will not have all the required parameters. After all, the attacker can not guess the value of the CSRF token.

Tokens should be generated as session tokens should be. They should be unpredictable, PRNG (pseudo-random number generator) should be used, etc.

Where are CSRF tokens transmitted?

Synchronized token pattern

There is an approach to transmit the token in a hidden HTML form field. This approach is often called the Synchronized token pattern. This pattern presents the flow of setting a unique, valid token for each HTTP request and then checking that value when the HTTP request is subsequently sent. It is done by setting hidden fields.

Example

The token would then be added in post request on form submit. We can create a hidden input field with the value which is the value of the CSRF token, something like this:

<input type="hidden" name="token" value="valueOfCSRFToken" />

It is very important that the hidden field is loaded before any non-hidden fields in HTML, so the attacker cannot catch the field’s content.

The problem with using this approach is that hidden token needs to be implemented on all HTML forms in the application. Also, you would need to keep track of the valid tokens from the server side and check out each request if it is using a valid token. 

There is also a possibility to send CSRF tokens in a custom request header using a cookie-to-header token pattern.

Cookie-to-header token pattern

This is the second anti-CSRF technique. The cookie should be set once in the session. After JS reads the cookie’s content, a custom HTTP header should be set (X-CSRF-TOKEN or X-XSRF-TOKEN or XSRF-TOKEN) with that value from the content. Each request will send a header with the mentioned token (from custom HTTP header) and the cookie (from standard HTTP header), so the server can check if those two values match.

Now we can be confused if we don’t figure out the point of this approach. But no worries, it is not so clear without knowing its exact idea. The purpose of it is that only JavaScript, which runs on the same domain as the cookie domain, would have access. So, only JS with the same domain can set up the correct value of the cookie’s content to the custom HTTP header.

This approach would only work with JavaScript requests (XHR requests). So, requests that would be set up by HTML form would not set the header. 

Example (JavaScript):

The web application is using session, and it sets session cookies. You can check out the Session Management article for more information regarding the sessions.

In the HTTP response header, Set-Cookie will be visible if HTTP is used to send a cookie from the server to the client side.

Content would be token, maximum age, expiration date, and cookie attribute, and it would look something like this:

Set-Cookie: __Host-token=RANDOM; Expires=Mon, 01-Jan-2023 12:55:00 GMT; Max-Age=31449600; Path=/; SameSite=Lax; Secure

It is essential to use cookie prefixes for a cookie with CSRF token value. This means that it can not be overwritten from another subdomain. The path should be “/.” And as you saw, it is marked as Secure, meaning it can not be sent over an unencrypted HTTP request. SameSite attribute helps the browser to decide if it should send cookies with cross-site requests. In this case, Lax is used; he is the default attribute. If you want to learn more regarding the SameSite attribute, check out this site.

When JavaScript (client side) reads a cookie, copy it to a custom HTTP header sent with each request. 

That would look something like this:

X-Csrf-Token: RANDOM

After, only validation of the token is left.

* The CSRF token cookie mustn’t have the httpOnly cookie flag! HttpOnly flag is used against XSS vulnerability because it makes the value of the cookie unavailable from JavaScript. So, you can conclude from the explanation that JavaScript will be prevented from reading X-Csrf-Token.

Double submit cookie pattern

There is the third pattern as the variation of the two mentioned patterns. This one puts the X-Csrf-Token value in a hidden form field but keeps the server-side logic simpler than the first pattern- The Synchronizer token pattern. This approach has some weaknesses, and you can check them on site.

Enabling CSRF in Angular

There is available Angular documentation for CSRF protection. 

First, you need to configure cookie/header names. To do that, you will need to import both HttpClientModule and HttpClientXsrfModule. In theory, it is easier to sync the names in the backend and frontend, but if you have different names on the server side, you can use the withOptions() method explained on this site.

  imports: [

      HttpClientModule,

      HttpClientXsrfModule.withOptions({

        cookieName: 'X-Csrf-Cookie',

        headerName: 'X-Csrf-Header',

      }),

    ]

In the mentioned documentation, you can find code that will help you test if your implementation is correct. 

Now we are left with intercepting requests and checking if the token in the cookie is the same value as it is in the HTTP request. In the code below, a custom interceptor class is created, which uses HttpXsrfTokenExtractor to get the token value so it can be compared.

@Injectable()

export class CustomHttpInterceptor implements HttpInterceptor {

    constructor(private spinnerService: SpinnerService, private toastrService: ToastrService,

        private httpXsrfTokenExtractor: HttpXsrfTokenExtractor) { }

    intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {

        const cookieheaderToken = 'X-XSRF-TOKEN';

        let csrfToken = this.httpXsrfTokenExtractor.getToken();

        if (csrfToken !== null && !req.headers.has(cookieheaderToken)) {

            req = req.clone({ headers: req.headers.set(cookieheaderToken, csrfToken) });

        }

        this.spinnerService.show();

        return next.handle(req)

            .pipe(tap((event: HttpEvent<any>) => {

                if (event instanceof HttpResponse) {

                    this.spinnerService.hide();

                }

            }, (error) => {

                if (error.status == 400) {

                    this.toastrService.error("Warning", error.error.Error)

                } else if (error.status == 500) {

                    this.toastrService.error("System error occurred");

                }

                this.spinnerService.hide();

            }));

    }

}

Conclusion

 

I hope I succeeded with a simple explanation of this type of attack. If you want to further investigate the prevention or even how the attack is performed, there is plenty of literature on the Internet. I found a lot of GitHub repositories with app samples for this attack. I think it is very good to check them out, but if you want to clone them, make sure it does not contain malicious code!

OWASP is constantly upgrading its Prevention Cheat Sheet for the Cross-Site Request Forgery, so you should check that one also.

Good luck with your investigation!

In the end, secure code is the cheapest code!

Cover photo by Philipp Katzenberger

#CSRF #cookie_to_header_token_pattern #synchronized_token_pattern

About Version 2 Digital

Version 2 Digital is one of the most dynamic IT companies in Asia. The company distributes a wide range of IT products across various areas including cyber security, cloud, data protection, end points, infrastructures, system monitoring, storage, networking, business productivity and communication products.

Through an extensive network of channels, point of sales, resellers, and partnership companies, Version 2 offers quality products and services which are highly acclaimed in the market. Its customers cover a wide spectrum which include Global 1000 enterprises, regional listed companies, different vertical industries, public utilities, Government, a vast number of successful SMEs, and consumers in various Asian cities.

About VRX
VRX is a consolidated vulnerability management platform that protects assets in real time. Its rich, integrated features efficiently pinpoint and remediate the largest risks to your cyber infrastructure. Resolve the most pressing threats with efficient automation features and precise contextual analysis.