CWE-841 行为工作流的不恰当实施

Improper Enforcement of Behavioral Workflow

结构: Simple

Abstraction: Base

状态: Incomplete

被利用可能性: unkown


The software supports a session in which more than one behavior must be performed by an actor, but it does not properly ensure that the actor performs the behaviors in the required sequence.


By performing actions in an unexpected order, or by omitting steps, an attacker could manipulate the business logic of the software or cause it to enter an invalid state. In some cases, this can also expose resultant weaknesses.

For example, a file-sharing protocol might require that an actor perform separate steps to provide a username, then a password, before being able to transfer files. If the file-sharing server accepts a password command followed by a transfer command, without any username being provided, the software might still perform the transfer.

Note that this is different than CWE-696, which focuses on when the software performs actions in the wrong sequence; this entry is closely related, but it is focused on ensuring that the actor performs actions in the correct sequence.

Workflow-related behaviors include:


  • cwe_Nature: ChildOf cwe_CWE_ID: 691 cwe_View_ID: 1000 cwe_Ordinal: Primary


范围 影响 注释
Other Alter Execution Logic An attacker could cause the software to skip critical steps or perform them in the wrong order, bypassing its intended business logic. This can sometimes have security implications.


This code is part of an FTP server and deals with various commands that could be sent by a user. It is intended that a user must successfully login before performing any other action such as retrieving or listing files.

bad Python

def dispatchCommand(command, user, args):
if command == 'Login':

# user has requested a file
if command == 'Retrieve_file':
if authenticated(user) and ownsFile(user,args):

if command == 'List_files':


The server correctly does not send files to a user that isn't logged in and doesnt own the file. However, the server will incorrectly list the files in any directory without confirming the command came from an authenticated user, and that the user is authorized to see the directory's contents.

Here is a fixed version of the above example:

good Python

def dispatchCommand(command, user, args):

if command == 'List_files':
if authenticated(user) and ownsDirectory(user,args):



标识 说明 链接
CVE-2011-0348 Bypass of access/billing restrictions by sending traffic to an unrestricted destination before sending to a restricted destination.
CVE-2007-3012 Attacker can access portions of a restricted page by canceling out of a dialog.
CVE-2009-5056 Ticket-tracking system does not enforce a permission setting.
CVE-2004-2164 Shopping cart does not close a database connection when user restores a previous order, leading to connection exhaustion.
CVE-2003-0777 Chain: product does not properly handle dropped connections, leading to missing NULL terminator (CWE-170) and segmentation fault.
CVE-2005-3327 Chain: Authentication bypass by skipping the first startup step as required by the protocol.
CVE-2004-0829 Chain: File server crashes when sent a "find next" request without an initial "find first."
CVE-2010-2620 FTP server allows remote attackers to bypass authentication by sending (1) LIST, (2) RETR, (3) STOR, or other commands without performing the required login steps first.
CVE-2005-3296 FTP server allows remote attackers to list arbitrary directories as root by running the LIST command before logging in.



映射的分类名 ImNode ID Fit Mapped Node Name
WASC 40 Insufficient Process Validation