exploit the possibilities

OpenSSL 1.0.2a Insecure Functions

OpenSSL 1.0.2a Insecure Functions
Posted Apr 3, 2015
Authored by Nicholas Lemonias

OpenSSL version 1.0.2a makes use of some insecure functions.

tags | advisory
MD5 | 67dab38b98557a8440b703be32d1326c

OpenSSL 1.0.2a Insecure Functions

Change Mirror Download
-=[Advanced Information Security Corp]=-


Author: Nicholas Lemonias
Report Date: 2/4/2015
Email: lem.nikolas@gmail.com

Introduction
==========
During a source-code audit of the OpenSSL v1.0.2a (Latest)
implementation for linux; conducted internally by the Advanced
Information Security
Group, instances of insecure function use were observed, which could
lead to a number of attacks.

Software Overview
===============
OpenSSL is an open-source implementation of the SSL and TLS protocol.
The core library is written in the C Language, and implements basic
cryptographic functions, and
also provides various utility functions. Implementation versions are
available for most UNIX-like operating systems (including
Solaris,Linux, Mac OS X and the various open-source BSD operating
systems), OpenVMS and Microsoft Windows. IBM provides a port for the
System i (OS/400). OpenSSL is based on SSLeay by Eric Andrew Young and
Tim Hudson, development of which unofficially ended on December 17,
1998, when Young and Hudson both started to work for RSA Security.


PoC 1 - Code Snippet [CWE 362]
========================
(.../openssl-1.0.2a/crypto/rand/randfile.c:264)

out = vms_fopen(file, "rb+", VMS_OPEN_ATTRS);
if (out == NULL)
out = vms_fopen(file, "wb", VMS_OPEN_ATTRS);
#else
if (out == NULL)
out = fopen(file, "wb");
#endif
if (out == NULL)
goto err;

#ifndef NO_CHMOD
chmod(file, 0600);

Description: The calling function does not provide any security
validation controls, which would effectively prevent a race condition.
The use of open() with the right attributes was agreed.


PoC 2 - Code Snippet [CWE 690]
========================
(.../openssl-1.0.2a/crypto/mem.c:386)

char *CRYPTO_strdup(const char *str, const char *file, int line)
{
char *ret = CRYPTO_malloc(strlen(str) + 1, file, line);

strcpy(ret, str);
return ret;
}

Description: The function call does not make sure that ret is not NULL.


PoC 3 - Code Snippet [CWE 134]
========================
(.../openssl-1.0.2a/ssl/kssl.c:970)

fprintf(stderr, (isprint(adata->contents[i])) ? "%c " : "%02x",
adata->contents[i]);


Description: The function call is prone to a format string attack.


Appendices
==========
Sincere Thanks to the OpenSSL team for their mutual efforts.

References
==========

[1] Oracle (2015). Basic Library Functions - Title: fopen() man pages
section 3: Basic Library Functions [Online]
Available at: http://docs.oracle.com/cd/E23824_01/html/821-1465/fopen-3c.html#scrolltoc
[Last Accessed 2 April, 2015]

[2] M. Howard, D. LeBlanc Writing Secure Code, Second Edition Microsoft Press

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

February 2020

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Feb 1st
    1 Files
  • 2
    Feb 2nd
    2 Files
  • 3
    Feb 3rd
    17 Files
  • 4
    Feb 4th
    15 Files
  • 5
    Feb 5th
    24 Files
  • 6
    Feb 6th
    16 Files
  • 7
    Feb 7th
    19 Files
  • 8
    Feb 8th
    1 Files
  • 9
    Feb 9th
    2 Files
  • 10
    Feb 10th
    15 Files
  • 11
    Feb 11th
    20 Files
  • 12
    Feb 12th
    12 Files
  • 13
    Feb 13th
    18 Files
  • 14
    Feb 14th
    17 Files
  • 15
    Feb 15th
    4 Files
  • 16
    Feb 16th
    4 Files
  • 17
    Feb 17th
    34 Files
  • 18
    Feb 18th
    15 Files
  • 19
    Feb 19th
    19 Files
  • 20
    Feb 20th
    20 Files
  • 21
    Feb 21st
    15 Files
  • 22
    Feb 22nd
    2 Files
  • 23
    Feb 23rd
    2 Files
  • 24
    Feb 24th
    16 Files
  • 25
    Feb 25th
    37 Files
  • 26
    Feb 26th
    0 Files
  • 27
    Feb 27th
    0 Files
  • 28
    Feb 28th
    0 Files
  • 29
    Feb 29th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2016 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close