4.3.4-Testing_for_Account_Enumeration_and_Guessable_User_Account

2023-10-18 11:15

本文主要是介绍4.3.4-Testing_for_Account_Enumeration_and_Guessable_User_Account,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Testing for Account Enumeration and Guessable User Account

ID
WSTG-IDNT-04

Summary

The scope of this test is to verify if it is possible to collect a set of valid usernames by interacting with the authentication mechanism of the application. This test will be useful for brute force testing, in which the tester verifies if, given a valid username, it is possible to find the corresponding password.

Often, web applications reveal when a username exists on system, either as a consequence of mis-configuration or as a design decision. For example, sometimes, when we submit wrong credentials, we receive a message that states that either the username is present on the system or the provided password is wrong. The information obtained can be used by an attacker to gain a list of users on system. This information can be used to attack the web application, for example, through a brute force or default username and password attack.

The tester should interact with the authentication mechanism of the application to understand if sending particular requests causes the application to answer in different manners. This issue exists because the information released from web application or web server when the user provide a valid username is different than when they use an invalid one.

In some cases, a message is received that reveals if the provided credentials are wrong because an invalid username or an invalid password was used. Sometimes, testers can enumerate the existing users by sending a username and an empty password.

Test Objectives

  • Review processes that pertain to user identification (e.g. registration, login, etc.).
  • Enumerate users where possible through response analysis.

How to Test

In black-box testing, the tester knows nothing about the specific application, username, application logic, error messages on log in page, or password recovery facilities. If the application is vulnerable, the tester receives a response message that reveals, directly or indirectly, some information useful for enumerating users.

HTTP Response Message

Testing for Valid Credentials

Record the server answer when you submit a valid user ID and valid password.

Using a web proxy, notice the information retrieved from this successful authentication (HTTP 200 Response, length of the response).

Testing for Valid User with Wrong Password

Now, the tester should try to insert a valid user ID and a wrong password and record the error message generated by the application.

The browser should display a message similar to the following one:

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传
Figure 4.3.4-1: Authentication Failed

Unlike any message that reveals the existence of the user like the following:

Login for User foo: invalid password

Using a web proxy, notice the information retrieved from this unsuccessful authentication attempt (HTTP 200 Response, length of the response).

Testing for a Nonexistent Username

Now, the tester should try to insert an invalid user ID and a wrong password and record the server answer (the tester should be confident that the username is not valid in the application). Record the error message and the server answer.

If the tester enters a nonexistent user ID, they can receive a message similar to:

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传
Figure 4.3.4-3: This User is Not Active

or a message like the following one:

Login failed for User foo: invalid Account

Generally the application should respond with the same error message and length to the different incorrect requests. If the responses are not the same, the tester should investigate and find out the key that creates a difference between the two responses. For example:

  1. Client request: Valid user/wrong password
  2. Server response: The password is not correct
  3. Client request: Wrong user/wrong password
  4. Server response: User not recognized

The above responses let the client understand that for the first request they have a valid username. So they can interact with the application requesting a set of possible user IDs and observing the answer.

Looking at the second server response, the tester understand in the same way that they don’t hold a valid username. So they can interact in the same manner and create a list of valid user ID looking at the server answers.

Other Ways to Enumerate Users

Testers can enumerate users in several ways, such as:

Analyzing the Error Code Received on Login Pages

Some web application release a specific error code or message that we can analyze.

Analyzing URLs and URL Redirections

For example:

  • http://www.foo.com/err.jsp?User=baduser&Error=0
  • http://www.foo.com/err.jsp?User=gooduser&Error=2

As is seen above, when a tester provides a user ID and password to the web application, they see a message indication that an error has occurred in the URL. In the first case they have provided a bad user ID and bad password. In the second, a good user ID and a bad password, so they can identify a valid user ID.

URI Probing

Sometimes a web server responds differently if it receives a request for an existing directory or not. For instance in some portals every user is associated with a directory. If testers try to access an existing directory they could receive a web server error.

Some of the common errors received from web servers are:

  • 403 Forbidden error code
  • 404 Not found error code

Example:

  • http://www.foo.com/account1 - we receive from web server: 403 Forbidden
  • http://www.foo.com/account2 - we receive from web server: 404 file Not Found

In the first case the user exists, but the tester cannot view the web page, in second case instead the user “account2” does not exist. By collecting this information testers can enumerate the users.

Analyzing Web Page Titles

Testers can receive useful information on Title of web page, where they can obtain a specific error code or messages that reveal if the problems are with the username or password.

For instance, if a user cannot authenticate to an application and receives a web page whose title is similar to:

  • Invalid user
  • Invalid authentication
Analyzing a Message Received from a Recovery Facility

When we use a recovery facility (i.e. a forgotten password function) a vulnerable application might return a message that reveals if a username exists or not.

For example, messages similar to the following:

  • Invalid username: email address is not valid or the specified user was not found.
  • Valid username: Your password has been successfully sent to the email address you registered with.
Friendly 404 Error Message

When we request a user within the directory that does not exist, we don’t always receive 404 error code. Instead, we may receive “200 OK” with an image, in this case we can assume that when we receive the specific image the user does not exist. This logic can be applied to other web server response; the trick is a good analysis of web server and web application messages.

Analyzing Response Times

As well as looking at the content of the responses, the time that the response take should also be considered. Particularly where the request causes an interaction with an external service (such as sending a forgotten password email), this can add several hundred milliseconds to the response, which can be used to determine whether the requested user is valid.

Guessing Users

In some cases the user IDs are created with specific policies of administrator or company. For example we can view a user with a user ID created in sequential order:

CN000100
CN000101
...

Sometimes the usernames are created with a REALM alias and then a sequential numbers:

  • R1001 – user 001 for REALM1
  • R2001 – user 001 for REALM2

In the above sample we can create simple shell scripts that compose user IDs and submit a request with tool like wget to automate a web query to discern valid user IDs. To create a script we can also use Perl and curl.

Other possibilities are: - user IDs associated with credit card numbers, or in general numbers with a pattern. - user IDs associated with real names, e.g. if Freddie Mercury has a user ID of “fmercury”, then you might guess Roger Taylor to have the user ID of “rtaylor”.

Again, we can guess a username from the information received from an LDAP query or from Google information gathering, for example, from a specific domain. Google can help to find domain users through specific queries or through a simple shell script or tool.

By enumerating user accounts, you risk locking out accounts after a predefined number of failed probes (based on application policy). Also, sometimes, your IP address can be banned by dynamic rules on the application firewall or Intrusion Prevention System.

Testing Staff Impersonation

Ensure that unregistered users are unable to select reserved usernames (e.g., admin, administrator, moderator) during the registration process. Additionally, verify that users cannot edit their current username to one of these reserved usernames on the profile editing page.

If the web application has features that allow a user to access the web application’s registration and profile editing functionality, the interactions to test include the following:

  • Registration process:
    • Access the registration page as an unregistered user and fill in the registration form, entering one of the reserved usernames (e.g., admin, administrator, moderator), submit the registration form, and then verify the response.
    • The registration process should reject the form submission and display an error message indicating that the selected username is not available for registration.
  • Profile editing page:
    • Log into the web application using valid credentials and navigate to the profile editing page. Attempt to change the current username to one of the reserved usernames (e.g., admin, administrator, moderator) and save the changes to verify the behavior.
    • The profile editing process should reject the username change request and display an error message indicating that the selected username is not available.
  • Test for variants and similarities:
    • Repeat the above steps for different variations of the reserved usernames (e.g., Admin, ADMIN, Administrator) and perform tests with different combinations of uppercase and lowercase letters to ensure case insensitivity is handled correctly.
    • The web application should treat these variants as identical to the reserved usernames, rejecting their selection or modification.

Gray-Box Testing

Testing for Authentication Error Messages

Verify that the application answers in the same manner for every client request that produces a failed authentication. For this issue the black-box testing and gray-box testing have the same concept based on the analysis of messages or error codes received from web application.

The application should answer in the same manner for every failed attempt of authentication.

For Example: Credentials submitted are not valid

Remediation

Ensure the application returns consistent generic error messages in response to invalid account name, password or other user credentials entered during the log in process.

Ensure default system accounts and test accounts are deleted prior to releasing the system into production (or exposing it to an untrusted network).

Tools

  • OWASP Zed Attack Proxy (ZAP)
  • curl
  • PERL

References

  • Username Enumeration Vulnerabilities
  • Prevent WordPress Username Enumeration
  • Marco Mella, Sun Java Access & Identity Manager Users enumeration

这篇关于4.3.4-Testing_for_Account_Enumeration_and_Guessable_User_Account的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/232202

相关文章

某城user_dun,js逆向分析

声明: 该文章为学习使用,严禁用于商业用途和非法用途,违者后果自负,由此产生的一切后果均与作者无关。 本文章未经许可禁止转载,禁止任何修改后二次传播,擅自使用本文讲解的技术而导致的任何意外,作者均不负责,若有侵权,请联系作者立即删除! 前言 这次会简单的讲解某城ly headers中参数userdun的逆向分析流程以及简单的补环境,如果有疑问可以在评论区交流讨论,我看到会及时回复的,另外,有

user is not in the sudoers file

出现这种情况是因为用户user没有sudo权限。解决办法自然是将当前用户添加到sudo成员中。  1.以root身份登录。 2.更改文件权限:  # chmod u+w /etc/sudoers  3.在/etc/sudoers文件中,root ALL=(ALL)ALL下方添加: user ALL=(ALL)ALL 保存退出。 4.还原文件权限:  # chmod u-w /etc

SIM(Search-based user interest modeling)

导读 我们对电商场景兴趣建模的理解愈发清晰:1. 通过预估目标item的信息对用户过去的行为做search提取和item相关的信息是一个很核心有效的技术。2. 更长的用户行为序列信息对CTR建模是非常有效且珍贵的。从用户的角度思考,我们也希望能关注用户长期的兴趣。但是当前的search方法无论是DIN和DIEN都不允许我们在线对一个超长的行为序列比如1000以上做有效搜索。所以我们的目标就比较明

cd swoole-4.3.2

宝塔安装swoole 新建文件夹 mkdir swoole 切入到文件夹中,进行下载安装包 wget http://pecl.php.net/get/swoole-4.3.2.tgz 解压 tar -zxvf swoole-4.3.2.tgz cd swoole-4.3.2 进行如下操作 phpize ./configure ./configure --with-php-config=

Django学习(二)(重写User类)

一、重写User类: 1、首先导入User类: from django.contrib.auth.models import User 2、然后点在User上,按住ctrl 点进去,发现 User类继承AbstractUser Ctrl点进去AbstractUser,然后将此方法全部复制到自己APP的models.py里: 可以修改名字,导入 from django.cont

替代 Django 默认 User 模型并使用 `django-mysql` 添加数据库备注20240904

替代 Django 默认 User 模型并使用 django-mysql 添加数据库备注 前言 在 Django 项目开发中,默认的 User 模型虽然能够满足许多基础需求,但在实际项目中我们常常需要对用户模型进行定制化。通过覆盖默认的 User 模型,我们可以根据具体的业务需求添加额外的字段、修改字段属性等。同时,使用 django-mysql,我们还可以在数据库迁移时为字段添加备注,提高数

How to user “Discrete“ object in openai-gym environments?

题意:怎样在 OpenAI Gym 环境中使用 “Discrete” 对象 问题背景: I am trying to create a Q-Learning agent for a openai-gym "Blackjack-v0" environment. I am trying to get the size of the observation space but its in

Enumeration 接口与 Iterator 接口的区别

Enumeration 接口与 Iterator 接口的区别 1、功能1.1 Enumeration1.2 Iterator 2、安全性和并发性3、总结 💖The Begin💖点点关注,收藏不迷路💖 Enumeration和Iterator是用于遍历集合的两个接口,但它们之间存在一些显著的区别。 1、功能 1.1 Enumeration 提供基本的遍历功能

user版本如何打开root权限之android8.1

1.修改ro.adb.secure和ro.secure属性 /code/1-android8.1/build/core$ git diffdiff --git a/core/main.mk b/core/main.mkindex 44ad271..947d7a3 100644--- a/core/main.mk+++ b/core/main.mk@@ -239,11 +239,11 @

Java 4.3 - Redis

目录 Redis 基础 Redis 简介 缓存数据的处理流程是什么样的? 为什么要用 Redis?(为什么要使用缓存?) Redis 除了做缓存之外,还可以做什么? Redis 可以做消息队列吗? Redis 数据类型  Redis 常用的数据类型有哪些? String 的应用场景有哪些? String 还是 Hash 来存储对象? Redis 如何实现一个排行榜