one or more computers • The attack is against another computer, multiple computers or networks • Two broad types : • Denial of service attack • Get target computer’s data
service unavailable to it’s intended users • For Eval function, the most common attack type is achieved by : • Inject a script that will cause a CPU intensive operation and cause the server to be too busy in performing it
/setTimeout: • The expression is not come from the user input • Use escaping techniques on the expression • Use blacklist / whitelist approach on the expression
- variables inside file paths • Allow the attacker to Access everything in your system • RegExp Injection - variables inside regex • Allow an attacker to DOS your server with a long-running regular expression
the request’s source ip • Block the requests if too many requests are coming from the same IP within specific time window • Can also help in preventing brute force password guessing attacks – • multiple requests are sent to a specific endpoint to guess the password
limit login routes per request ip, and also per username and password. • Limiting login routes per username can be very helpful to prevent password brute force attacks • In many attacks, using only IP parameter is not enough – since requests can come from multiple IPs.
Node.js is to build a REST api using express library. • Most developers writing the REST layer using Express library. • Usually, input is taken from request body or url query . • In most cases, input is transferred to the next layer in the pipeline as it received from user.
to a program • The input will get processed as part of the execution of the software • The input can cause damage to the software • Example : • SQL injection • Command injection
are added with middlewares. • It is crucial to add a middleware that performs input validations on the requests that arrives to the server. • You can write one yourself – or use one of the known middlewares exists.
: • Optional parameters • Validating hex colors • Matching a url or a constant value • Validating numbers • Provide a schema to the validator to create any rule based validation required to your application
special characters • Can be used to sanitize the input you give to the DB • You can wrap each parameter to protect from query injections. • Can be used for escaping HTMLs , JavaScript scripts and too.
• Enables to access operating system functionality by running system commands in a child process • Control child process’s input stream • Listen to the child process’s output stream
– that limit you to execute one command • Always validate and sanitise user input. • Limit permissions of parent and child process , by using the appropriate identities in your system.