Tech Blog

Technology

Why User Inputs are Unreliable

By Neethu EC4 min read
← Back to blog

Today, most applications are interactive. Applications accept one or more forms of user inputs. But the question is – are these user inputs reliable? As we all know, not all users can be trusted. As such, it is difficult to assess which inputs are genuine and which aren’t.

User inputs may be in the form of text, a file, and so on. Even an attacker can pretend to be a normal user and try to inject malicious codes and upload malicious files into the application server to gain access to the server. Thus, user inputs may not always be reliable. However, proper security measures can help prevent attacks caused by improper handling of user inputs.

In the text format, an attacker can try to inject a malicious code directly or indirectly (encoding or encrypting a value to bypass the firewall or the rules set to tighten security) into the application server. Similarly, malicious files can be embedded into normal file types that can be uploaded into the application to gain access to the server. 

We can mitigate risks posed by user inputs by imposing certain restrictions. The restrictions should be set from the browser level to the server level. Here, input validation and input sanitization play a major role. It’s also important to have a Web Application Firewall (WAF) and set  rules to neutralize  attacks from user inputs (like restricting the kinds of inputs users can provide). 

Proper security configuration in web applications, web servers, and databases are also crucial. Policies should be defined to ensure proper access control to web applications, such as role-based or authentication-based access control for different types of privileged users. It’s also important to properly monitor the actions performed in the web server and set rules for alerts to be sent to concerned people if any malicious actions are detected. 

Some of the examples of improper user input are as follows:

  • Consider a text field through which a user can provide an input. 

Here, there is no input sanitization. So, the user can enter any input and submit it. All inputs will be accepted. If we try with a simple java script, it will just show the following alert:

<script>alert(“Cross Site Scripting”)</script>

If you click on the submit button. The following alert will show.

This is called “Cross Site Scripting”. If an attacker tries to execute any javascript code into the client machine, the input will be accepted due to lack of improper input handling of the application. 

However, with proper input handling, it won’t execute the javascript code in the client machine. It will just take the input and display the following message.:

That’s because, in this case, a proper input sanitization mechanism has been put in place.

  • Let’s consider another example where the user can upload a file into the web application.

Here, it has been specified that an image file has to be uploaded. But we can upload any file if the file type is not checked. Now, if we try to upload a .php extension file, which contains a backdoor, we’ll be able to do so as no restrictions are applied here.

This is a major security concern- “unrestricted file upload” – one that can be mitigated with proper input validation.

Now, consider a scenario where a proper validation mechanism is in place. Here, we’ll not be able to upload the file.

In this case, proper file upload restrictions are in place.

Conclusion:

User inputs in any form are unreliable. But implementing proper security measures can go a long way in assessing which inputs can be trusted and which not. So, each input, regardless of the format, must be validated properly(texts, file uploads, etc).

Keep reading

You may be interested in

Browse all articles →
Using SCEP Certificates with Okta and SureMDM for Zero Trust Security
August 5, 20257 min read

Using SCEP Certificates with Okta and SureMDM for Zero Trust Security

For businesses embracing zero-trust principles, secure certificate-based authentication isn’t just nice to have—it’s a necessity. With Okta as your Identity Provider (IdP) and SureMDM as your unified endpoint management solution, you can now seamlessly distribute and manage device certificates using Simple Certificate Enrollment Protocol (SCEP). This blog will guide you through: Why Use SCEP with […]

By Sunny KumarRead More →
How to Use mc CLI for Bucket Management and Credential Setup
June 12, 20252 min read

How to Use mc CLI for Bucket Management and Credential Setup

MinIO client The MinIO Client, commonly known as mc, is a command-line tool used to interact with MinIO, a high-performance object storage system. The mc client allows users to manage buckets and objects on the MinIO storage service.

By Malkeet SinghRead More →
How to Setup Passwordless SSH Login for ADE
March 18, 20253 min read

How to Setup Passwordless SSH Login for ADE

To set up a passwordless SSH login in Linux all you need to do is to generate a public authentication key and append it to the remote hosts ~/.ssh/authorized_keys file. The following steps will describe the process for configuring passwordless SSH login: 1. Check for existing SSH key pair Before generating a new SSH key […]

By Mohan Kumar KMRead More →