Reading Standard Input is security-sensitive. It has led in the past to the following vulnerabilities:

It is common for attackers to craft inputs enabling them to exploit software vulnerabilities. Thus any data read from the standard input (stdin) can be dangerous and should be validated.

This rule flags code that reads from the standard input.

Ask Yourself Whether

You are at risk if you answered yes to this question.

Recommended Secure Coding Practices

Sanitize all data read from the standard input before using it.

Sensitive Code Example

Imports System
Public Class C
    Public Sub Main()
        Dim x = Console.[In] ' Sensitive
        Console.Read() ' Sensitive
        Console.ReadKey() ' Sensitive
        Console.ReadLine() ' Sensitive
        Console.OpenStandardInput() ' Sensitive
    End Sub
End Class

Exceptions

This rule does not raise issues when the return value of the Console.Read Console.ReadKey or Console.ReadLine methods is ignored.

Imports System

Public Class C
    Public Sub Main()
        Console.ReadKey() ' Return value is ignored
        Console.ReadLine() ' Return value is ignored
    End Sub
End Class

See

Deprecated

This rule is deprecated, and will eventually be removed.