595
The J2EE application directly uses sockets instead of using framework method calls.
Extended Description
The J2EE standard permits the use of sockets only for the purpose of communication with legacy
systems when no higher-level protocol is available. Authoring your own communication protocol
requires wrestling with difficult security issues.
Without significant scrutiny by a security expert, chances are good that a custom communication
protocol will suffer from security problems. Many of the same issues apply to a custom
implementation of a standard protocol. While there are usually more resources available that
address security concerns related to implementing a standard protocol, these resources are also
available to attackers.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 695 Use of Low-Level Functionality 1524
Weakness Ordinalities
Resultant :
Applicable Platforms
Language : Java (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Other Quality Degradation
Detection Methods
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST),
can find some instances of this weakness by analyzing source code (or binary/compiled code)
without having to execute it. Typically, this is done by building a model of data flow and control
flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input)
with "sinks" (destinations where the data interacts with external components, a lower layer such
as the OS, etc.)
Effectiveness = High
Potential Mitigations
Phase: Architecture and Design
Use framework method calls instead of using sockets directly.
Demonstrative Examples
Example 1:
The following example opens a socket to connect to a remote server.
Example Language: Java (Bad)
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Perform servlet tasks.
CWE Version 4.14
CWE-248: Uncaught Exception
CWE-248: Uncaught Exception