-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
Suggestions for Improvement in Detecting Hidden Form Elements Methods #2184
Comments
Just to note: it's very slow and costly to start checking every element, it parents and the DOM tree. The current implementation is a compromise that does quick checks without slowing down the extension too much. There's a separate Improved Input Field detection that can be enabled per site, and it does some more accurate identification. |
Thank you very much for your prompt and detailed response! We understand the necessity of balancing between ensuring smooth extension operation and enhancing the accuracy of input field detection. We believe adopting a better recognition scheme could further ensure the security of autofill capabilities, and we hope you might make some improvements, if possible. Besides, we are excited to hear about the development of the "Improved Input Field detection" feature as a solution for more precise identification. We would like to know a bit more about several aspects:
I greatly appreciate the efforts and innovations the KeePassXC team has made to provide a more secure and efficient user experience. I look forward to your reply and learning more about how to fully leverage this advanced feature of KeePassXC. Best Regards, Felix |
Hello, if you have proposed code changes, then you should start a pull request. See here for how to do that: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request |
At this point it mostly just traverses the children of elements, looking for input fields and ignoring any unwanted nodes. This is helpful for example when identifying input fields inside Shadow DOM.
Extension settings has a Site Preferences tab, where a URL can be added with that option enabled.
|
Dear KeePassXC team, I want to extend my sincere thanks for your kind and informative response to my query. Your explanation is incredibly helpful and provides me with a clearer understanding of the matter. Besides, I am motivated to contribute directly to the project and preparing to submit a pull request for my developed code. I look forward to potentially collaborating with the team and am eager to contribute to the community. Thank you once again for your supportive and constructive feedback. Best regards, |
Let's talk about the risk we are trying to solve here since that matters when balancing security and performance/usability. One reason to detect well hidden fields is to prevent an attacker scenario where a malicious script is running on an otherwise trusted site. In this scenario, I doubt enhanced visibility checks are going to save you. Visibility checks are mainly to prevent false positive fill recommendations with a side benefit of potential security. |
Thanks for your response. In my opinion, when the Best regards, |
Dear KeePassXC Developer Team,
We have recently delved into the KeePassXC AutoType (or Autofill functionality) to detect the visibility of web form elements. Through meticulous debugging and analysis, we have identified potential areas for improvement in the current detection method to provide a more robust security guarantee. We believe that enhancing this detection mechanism can further bolster the security and accuracy of KeePassXC when dealing with hidden form elements.
We have inspected the
isVisible
function in the source codehttps://github.com/keepassxreboot/keepassxc-browser/blob/develop/keepassxc-browser/content/fields.js
, and observed the existing implementation. It conducts its detection process through the following steps: it starts by checking the size and position of the element, then verifies the CSS visibility of the element, and finally the opacity of its parent elements.We now summarize the results and report the following scenarios: the password field is hidden, and KeePassXC should have detected its invisibility and should not autofill the password into it. After inspecting and debugging the source code, we find several potential issues.
overflow: hidden
property to achieve hiding. (1-Overlay)f.style
method to detectopacity
presents a limitation, as it only captures inline CSS property values directly defined within the element (e.g.,<input id="password" style="opacity: 0;">
). This means thatopacity
set through nested CSS files or<style>
tags in the HTML<header>
tags for a parent element cannot be effectively detected. (2-Parent-Opacity)clip
andclip-path
, which may lead to certain hiding techniques not being promptly identified. (3-Clip-Path-Self)content-visibility
orclip-path
). This might result in elements that are capable of being filled but are invisible being missed. (4-Content-Visibility-Parent)We have provided four examples on a demo website to demonstrate the reproduction process.
Expected Behavior
We provide four types of web forms for reproduction, where we hide the
password
field using one of the four above techniques in login forms and only ausername
and alogin
button are available. The expected behavior should be that thepassword
field should not be detected and thepassword
value should not be filled into the hidden field.Current Behavior
The current behavior is that KeePassXC detects a password field in the web form without a visible
password
field and fill the password into the field.Possible Solution
Based on the above-reported issues, we suggest the developers to utilize a more comprehensive method for detecting hidden fields. For instance, developers could refer to Bitwarden's method. We have developed an improved method for KeePassXC. The main modification is as follows. We can attach the modified file in this thread if required.
if-else
in the Check CSS visibility part.f.style
intogetComputedStyle(f)
isElementNotHiddenButBehindAnotherElement
function to check whether the target element is hidden behind another another element.Developers could improve this method to detect hidden elements accurately and effectively. Could we request a pull request to add this code?
Steps to Reproduce (for bugs)
As we have implemented four website instances to demonstrate the invisible element detection issues, we utilize the same login form for each website, where the
username
field is visible and thepassword
field is hidden using different techniques. The reproduction process is the same.testuser
andtestpassword
) in the KeePassXC desktop application.F12
to call the Chrome Browser DevTools, and inputdocument.getElementById("password").value;
in the console.password
field, but this field is detected by KeePassXC, and we can usedocument.getElementById("password").value;
in DevTools to get the password value.Debug info
KeePassXC - 2.7.7
KeePassXC-Browser - 1.9.0.3
Operating system: Win64
Browser: Chrome/Chromium 124.0.0.0
The text was updated successfully, but these errors were encountered: