See all GNU/Linux related FAQ
The GHOST (CVE-2015-0235) is serious network function vulnerability in Glibc. How do I check and test if a my Linux based server is secure using command line options?

There are two methods to test and find out if your server or desktop powered by Linux is secure or not:

(a) A simple C test program for all Linux based servers (distro independent; generic method). [donotprint]

Tutorial details
Difficulty level Easy
Root privileges No
Requirements Linux
Est. reading time 2 minutes

(b) A simple bash shell test program for RHEL or CentOS or Scientifc Linux server only.

Method #1: GHOST.C Glibc Vulnerability Test C Program

Type the following wget command to download GHOST.C on a Linux based system:

## OR
wget -O GHOST.c

Compile it:

gcc -o GHOST GHOST.c

Test i:


Sample outputs:

Fig. 01: GHOST.c  bug:  A simple way to test if Linux system is secure or not

Fig. 01: GHOST.c bug: A simple way to test if Linux system is secure or not

Method #2: Vulnerability Test Bash Script

Visit this url to download a script (or grab it here). You need to have an account with RHN. The script tells whether your system is vulnerable or not. Run script as follows:

wget -O

Sample outputs:

Fig.02: Fig.02: output on a RHEL/CentOS  based system

Fig.02: Fig.02: output on a RHEL/CentOS based system

What to do if my server is not secure or Vulnerable to the Ghost attack?

See this tutorial page for securing your server by applying patches to glibc.

This entry is 1 of 2 in the Linux GHOST Glibc Critical Security Vulnerability series. Keep reading the rest of the series:
  1. Check Ghost Vulnerability Test Programs
  2. Secure and Patch Your Linux Server For Ghost Bug

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

17 comments… add one
  • Deepu Apr 6, 2015 @ 11:49

    Method #2: Vulnerability Test Bash Script

    as per the ghost shell script, it says glibc 2.12 is not vulnerable in the screen shot.

    But version in between 2.2 to 2.17 all are vulnerable to GHOST attack. refer link :

    after referring the NVD, looks like the script is not working properly.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.