NShiftKey-Rule-Guide logo NShiftKey-Rule-Guide

1. Vulnerability Description

1

[Figure 1. Example of vulnerability]

2. How to check vulnerability

2.1. Review comments inside code

2

[Figure 2. Case with detailed comments]

2.2. Check error messages

Input data type differently : ex) view.asp?no=test
Input value exceeds the acceptable range : ex) view.asp?no=-99999
Input special characters : ex) view.asp?no=’”

2.3. Check type settings

3

[Figure 3. Example of inc file exposure]

3. Vulnerability Countermeasure

3.1. Review comments inside code

3.2. Check error messages

Validation and exception handling for input values

Collective linking to a separate error page

Change settings

PHP

Secure web programming

ASP

4. Sample Code

Example of recording password information in the comment text to help the developer understand

...
public void daoTest() throwsException {
    // write password in the comment text to help the developer understand
    // dbsample : 84d5d0a08a3ec5e2d91a
    // before and after encryption : 1365ADMIN_01, aa84c40031d808196537ad3dcf81f9af
    String pwd = "aa84c40031d808196537ad3dcf81f9af";
    String pwd1 = ARIAEngine.decARIA(pwd);
    System.out.println(pwd1);
}
...
public void daoTest() throwsException {
    // Delete comments containing the password
    String pwd = "aa84c40031d808196537ad3dcf81f9af";
    String pwd1 = ARIAEngine.decARIA(pwd);
    System.out.println(pwd1);
}

Examples of information exposure through error messages

try {
    rd = new BufferedReader(new FileReader(new File(filename)));
}
catch(IOException e) {
    e.printStackTrace(); //Stack information is exposed through an error message
}
try {
    rd = new BufferedReader(new FileReader(new File(filename)));
}
catch(IOException e) {
    logger.error(“ERROR-01: File open error”); // Define error code and information separately, and log only minimum information
}
finally{
    try {
        rd.close();
    }
    catch (IOException ex) {
        logger.error(“ERROR-02: File close error”);
    }
}