1332
Demonstrative Examples
Example 1:
The following example demonstrates the weakness.
Example Language: C (Bad)
#define CERT "secret.pem"
#define CERT2 "secret2.pem"
int main(){
SSL_CTX *ctx;
SSL *ssl;
init_OpenSSL();
seed_prng();
ctx = SSL_CTX_new(SSLv23_method());
if (SSL_CTX_use_certificate_chain_file(ctx, CERT) != 1)
int_error("Error loading certificate from file");
if (SSL_CTX_use_PrivateKey_file(ctx, CERT, SSL_FILETYPE_PEM) != 1)
int_error("Error loading private key from file");
if (!(ssl = SSL_new(ctx)))
int_error("Error creating an SSL context");
if ( SSL_CTX_set_default_passwd_cb(ctx, "new default password" != 1))
int_error("Doing something which is dangerous to do anyways");
if (!(ssl2 = SSL_new(ctx)))
int_error("Error creating an SSL context");
}
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 948 SFP Secondary Cluster: Digital Certificate 888 2395
MemberOf 1396 Comprehensive Categorization: Access Control 1400 2519
Related Attack Patterns
CAPEC-ID Attack Pattern Name
94 Adversary in the Middle (AiTM)
CWE-594: J2EE Framework: Saving Unserializable Objects to Disk
Weakness ID : 594
Structure : Simple
Abstraction : Variant
Description
When the J2EE container attempts to write unserializable objects to disk there is no guarantee that
the process will complete successfully.
Extended Description
In heavy load conditions, most J2EE application frameworks flush objects to disk to manage
memory requirements of incoming requests. For example, session scoped objects, and even
application scoped objects, are written to disk when required. While these application frameworks
do the real work of writing objects to disk, they do not enforce that those objects be serializable,
thus leaving the web application vulnerable to crashes induced by serialization failure. An attacker
may be able to mount a denial of service attack by sending enough requests to the server to force
the web application to save objects to disk.
CWE Version 4.14
CWE-594: J2EE Framework: Saving Unserializable Objects to Disk
CWE-594: J2EE Framework: Saving Unserializable Objects to Disk