Since the REST architecture manner is based on the HTTP protocol, these services are prone to the same exposures as standard web applications, including broken hallmark, injection onslaughts, cross-site scripting and cross-site petition counterfeit. Besides REST services face alone security challenges with Web 2.0 applications such as mash-ups.

This article explains how REST security differs from HTTP security and suggests assorted security mechanisms to turn to REST security challenges.A

This article besides throws some light on industry broad enterprises to supply criterions based security mechanism for REST services.

What is REST?

The REST attack is one of the major attacks to edifice distributed systems utilizing “ pure ” web engineerings ( HTTP, HTML etc ) and is widely known as the resource-oriented attack. REST ( REpresentational State Transfer ) is a term coined by Roy Fielding in his PhD thesis depicting a resource-oriented architecture manner for networked systems[ 1 ].

Best services for writing your paper according to Trustpilot

Premium Partner
From $18.00 per page
4,8 / 5
Writers Experience
Recommended Service
From $13.90 per page
4,6 / 5
Writers Experience
From $20.00 per page
4,5 / 5
Writers Experience
* All Partners were chosen among 50+ writing services by our Customer Satisfaction Team

An of import construct in REST is the being of resources ( beginnings of specific information ) , each of which is referenced with a planetary identifier ( such as an HTTP URI ) . In order to pull strings these resources, constituents of the web ( user agents and origin waiters ) communicate via a standardised interface ( such as HTTP ) and exchange representations of these resources ( the existent paperss conveying the information )[ 2 ].

Security for REST services and APIs

Because of the built-in HTTP properties of REST like simpleness, openness, and scalability, more and more Application Programming Interfaces ( API ) are being developed utilizing REST rules. While making so bing HTTP Web application security theoretical accounts ( such as HTTPS and other mandate and hallmark mechanisms ) are besides adopted to supply security for REST applications.

Differences between REST security and SOAP security

Though it ‘s interesting to compare REST to SOAP, purely talking they are non straight comparable, since REST is an attack while SOAP is a protocol. Still, they ‘re frequently treated as options, so we will look at them together. SOAP allows supplication of distant process calls ( RPC ) via HTTP ports to supply web services support across organisational boundaries. Many Remainder developers consider this as a major defect that compromises web security.

This occurs because policies have been made around standard port Numberss to separate applications, such as port 80 for HTTP. Any service can be blocked by making the necessary constellation at the firewall degree, an attack that makes it easy to hold control over the applications that may be used. However, SOAP over HTTP displacements this job to the bed above by burrowing distant methods pver the standard HTTP port. At the TCP degree it is no longer possible to separate the application or service being used the larboard figure alternatively content of the HTTP messages or SOAP messages must be analyzed to command entree to certain applications or services.

Remainder calls besides go over HTTP or HTTPS but with the aid of firewall or similar package one can easy place the purpose of the REST message by analysing the HTTP bids used in the petition ( for illustration, GET is ever considered safe as it can non modify any informations or province of the waiter )

It is non possible for a firewall to place the purpose of a SOAP petition sent utilizing the HTTP POST method to pass on with a given service, without inspecting the SOAP envelope. For illustration, there is no manner to state whether purpose is to question the information or wipe out the information.

For implementing hallmark and mandate, SOAP places the load on the application developer whereas the REST methodological analysis relies on Web waiters.

Challenges faced by REST APIs and Applications

Since the REST architecture manner is based on the HTTP protocol, these services are prone to the same exposures as standard web applications such as:

Unvalidated Input signal: Attackers can utilize these defects to assail backend constituents through a web applications or REST API. It is really of import to formalize input informations as it traverses the application bed. A big figure of onslaughts can be avoided by formalizing input informations, whether obtained from the client, from the substructure, from external entities or from database systems.

“ Never trust inputs without verifying them ”

REST APIs should ne’er swear inputs without verifying them. Here are some of the standard web application security techniques that can be applied to Rest:

Validating the size of parametric quantities on the question twine

Validating the content of parametric quantities on the question twine

Analyzing parametric quantities in the question twine for known onslaughts such as SQL Injection

Using regular looks to question twine parametric quantities

Broken Authentication: If limitations on what attested users are allowed to make are non decently enforced, aggressors can work these defects to derive control of other users ‘ histories, entree sensitive informations, or execute unauthorised maps.

Injection Attacks: Web applications pass parametric quantities when they entree external systems or the local operating system. If an aggressor can shoot malicious bids in these parametric quantities, the external system may put to death those bids on behalf of the web application.

Some of the input proof techniques mentioned above can be used to guard REST APIs against Injection onslaughts.

Immature Protocols: New protocols may non ever decently handle security. For illustration, OAuth 1.0 ( E. Hammer-Lahav, 2010 ) is vulnerable to a session-fixation onslaught that could let an aggressor to steal the individuality of an API end-user ( OAuth Security Advisory: 2009.1, 2009 )

Besides REST services face extra security challenges from browser scripting and Web 2.0 attacks like mash-ups:

Cross-site scripting ( XSS ) and cross-site petition counterfeit where a web application can be used as a mechanism to transport an onslaught to an terminal user ‘s browser. A successful onslaught can unwrap the terminal user ‘s session item, attack the local machine, or burlesque content to gull the user.

Web 2.0 and Rich Internet Applications ( RIA ) rely to a great extent on REST APIs, doing these APIs prone to XSS onslaughts.

A mash-up that retrieves informations from multiple APIs might necessitate user certificates. It ‘s up to the mash-up supplier to authenticate end-users ‘ entree certificates ( such as same-origin beltway ) .

End users must swear the mash-up supplier non to steal ( or unwittingly uncover ) their certificates and the API suppliers must swear that the mash-up supplier has authenticated the valid user of this history, non a hacker or malicious user.

Best patterns for REST services security

Unlike WS-* that specifies a chiseled security theoretical account that is protocol independent and is built specifically for SOAP web services, REST does non presently have its ain security theoretical account. Alternatively, today ‘s REST security best patterns purchase bing HTTP security execution attacks.

Following are the some of the regulations recommended for procuring REST services by Comerford and Soderling ( Soderling, 2010 )[ 3 ]

Make use the same security mechanisms for your APIs as any web application your organisation deploys. For illustration, if you are filtrating for XSS on the web front-end, you must make it for your APIs, sooner with the same tools.

Do n’t contrive or turn over out your ain security. Use a model or bing library that has been peer-reviewed and tested.

Unless your Remainder API is a read-only public API, do n’t utilize individual key-based hallmark. This is non plenty. Add a password demand.

Do n’t go through unencrypted inactive keys. If you are utilizing HTTP Basic and directing it across the wire, code it.

If possible, utilize a hash-based message hallmark codification ( HMAC ) because it ‘s the most unafraid

Filtering question strings is of import. For this REST security can follow criterion to Web Application Security attacks.

Web Application security mechanisms and REST services

Let us look at some of the major HTTP security attacks within the range of REST to see how they help in procuring REST services.

The followers are some of the some of the chief HTTP attacks for procuring web applications

HTTP hallmarks

Token based hallmark

Transport Layer Security ( TLS ) protecting Sessionss over the Internet

HTTP Authentication Schemes

HTTP hallmark mechanisms can be divided into two classs:

Basic Authentication strategy

Digest Authentication strategy

Basic Authentication Scheme

The Basic Authentication strategy is the simplest hallmark strategy[ 4 ]defined in RFC 2617[ 5 ]. It sends a HTTP heading called ‘Authorization ‘ with the Base64 encryption of the “ & lt ; username & gt ; : & lt ; watchword & gt ; ” twine.

If the provided hallmark information is valid, the content of the requested resource is returned along with HTTP position codification of 200. If authentication information is non valid ; that is, if the petition is issued without the ‘Authorization ‘ heading or if the provided certificates are invalid, the waiter responds back to the client with a HTTP position codification of 401 bespeaking hallmark.

The Basic Authentication strategy is besides called preemptive hallmark as it requires clients to direct the hallmark heading in the first petition, with no extra client interaction required. Because of this preemptive nature, Basic Authentication can be considered as executing somewhat better than Digest ( challenge-response ) hallmark that requires a re-issuing of the petition with a response to the challenge presented.


Simple and easy to utilize

About all HTTP libraries support it


Transmits the username and watchword in a clear and easy decryptable mode ( Base64 coding )

Because of its simpleness, the Basic Authentication strategy is widely popular and supported by the bulk of REST API executions. It is normally appropriate merely over unafraid connexions i.e. HTTPS.

Digest Authentication Scheme

Digest entree hallmark is one of the agreed methods a web waiter can utilize to negociate certificates with a client ( such as a web user ‘s browser ) . It uses encoding to direct the watchword over the web which is safer than the Basic entree hallmark. Technically, digest hallmark is an application of Message-Digest algorithm 5 ( MD5 ) cryptographic hashing utilizing time being values ( defined below ) to deter cryptanalytics. Digest entree hallmark was originally specified by RFC 2069[ 6 ]

Digest hallmark is a challenge-response mechanism, where a client application ( such as a browser ) sends an HTTP petition ( such as GET ) to a web waiter. The waiter sees the resource ( or URL ) being accessed has been configured to necessitate Digest hallmark and answers with a 401 “ Authentication Required ” position along with a “ time being ” – a alone hash of several informations points, one of which is a secret key known merely to the waiter.

The client application computes an MD5 hash of the username, watchword, time being and URL and resends the original petition along with the hash.

The web waiter compares that hash with its ain calculation of the same values. If they match, the original HTTP petition is allowed to entree the specified resource.


The watchword is non used straight in the digest. Alternatively, the stored value is a hash generated utilizing MD5 ( username: kingdom: watchword ) .

The client time being introduced in RFC2617 allows the client to forestall chosen plaintext onslaughts, by bring forthing different time beings each clip that the 401 hallmark challenge response codification is presented

Replay onslaughts can be prevented by including a timestamp in the waiter time being submitted by client.

The waiter can keep a list of late issued or used server time being values to forestall reuse


Many of the security options in RFC 2617 are optional. If quality-of-protection ( qop ) is non specified by the waiter, the client will run in a security-reduced bequest RFC 2069 manner

Digest entree hallmark is vulnerable to a man-in-the-middle ( MitM ) onslaught

Digest hallmark involves excessively much traffic HTTP hallmark is normally a two-step procedure to set up a session, but RESTful services do n’t normally hold any sort of session.

Token Based Authentication

Token based hallmark is the attack used by Amazon Web Services ( AWS ) for authenticating REST services. In the context of Amazon Web Services ( AWS ) petitions, hallmark is the procedure AWS uses to both confirm that a petition came from a registered user, and obtain the individuality of that registered user.

To enable hallmark, each petition must transport information about the individuality of the petition transmitter. The petition must besides incorporate extra information that AWS can utilize to verify that the petition can merely hold been produced by the transmitter identified. If the petition passes this confirmation trial it is determined to be “ reliable ” and AWS has sufficient information to verify the individuality of the transmitter.

Verifying the individuality of the transmitter of a petition is of import, as it ensures that merely those petitions made by the individual or party responsible for the AWS history specified in the petition are accepted and allowed to interact with AWS services. In this mode, petition hallmark allows Amazon to track the use of AWS services on a per petition footing. This enables Amazon to bear down and measure AWS endorsers for usage of AWS paid ( non loose ) services.

The undermentioned stairss are the basic stairss used in authenticating petitions to AWS. It is assumed that the developer has already registered with AWS and received an Access Key ID and Secret Access Key.

The transmitter constructs a petition to AWS.

The transmitter calculates a Keyed-Hashing for Message Authentication codification ( HMAC ) , the petition signature utilizing the transmitter ‘s Secret Access Key and the values of the Service, Operation, and Timestamp parametric quantities as input.

The transmitter of the petition sends the petition informations, the signature, and Access Key ID ( the key-identifier of the Secret Access Key used ) to AWS.

AWS uses the Access Key ID to look up the Secret Access Key

This non genuinely private as Amazon besides knows the transmitter ‘s private key.

AWS generates a signature from the petition informations and the Secret Access Key utilizing the same algorithm used to cipher the signature in the petition.

If the signature generated by AWS matches the one sent in the petition, the petition is considered to be reliable. If the comparing fails, the petition is discarded, and AWS returns an mistake response.

This attack is a reinvention of a subset of SOAP/WS-Security functionality for REST. Concepts used from WS-Security are:

WS-Security UsernameTokens with timestamp support, for directing username items

WS-Security ‘s support for XML Signature


No demand to interchange user certificates

Helps in formalizing the individuality of the transmitter of a petition

Helps is in tracking, using Access Control List ( ACL ) and policies ; for illustration, the figure of petition per hr ;


No cogent evidence of ownership of the Secret Access Key

This attack is better than Basic or digest hallmarks attacks and provides better security with for RESTful services much overhead.

Transport Layer Security ( TLS ) and Secure Socket Layer ( SSL )

Transport Layer Security ( TLS ) and its predecessor, Secure Sockets Layer ( SSL ) , are cryptanalytic protocols that provide communications security over the Internet. TLS and SSL encrypt the sections of web connexions above the Transport Layer, utilizing symmetric cryptanalysis for privateness and a keyed message hallmark codification for message dependability. Transport Layer Security ( TLS ) or Secure Socket Layer ( SSL ) provides transport degree, point-to-point security[ 7 ].

In the TSL attack client and waiter negotiate a Stateful connexion by utilizing a handshaking process and holding on assorted parametric quantities used to set up the connexion ‘s security.

The client application novices handshaking by linking to a waiter, bespeaking a secure connexion, showing a list of supported cyphers and hash maps. From this list, the waiter picks the strongest cypher and hash map supported by the waiter and notifies the client of the determination.

The waiter sends back its designation in the signifier of a digital certification. The certification normally contains the waiter name, the sure certification authorization ( CA ) and the waiter ‘s public encoding key.

The client may reach the waiter that issued the certification ( the trusted CA as above ) and confirm that the certification is valid before proceeding.

In order to bring forth the session keys used for the secure connexion, the client encrypts a random figure with the waiter ‘s public key and sends the consequence to the waiter. Merely the waiter should be able to decode it, with its private key. From the random figure, both parties generate cardinal stuff for encoding and decoding.

This concludes the handshaking and begins the secured connexion, which is encrypted and decrypted with the cardinal stuff until the connexion closes.


Encoding protects petition and response organic structures from intermediate prising eyes.

Server authenticated – Clients can hive away the waiter ‘s SSL certification and supervise the waiter to guarantee it does non alter over clip to guard against a man-in-the-middle type onslaught.

Using a certification signed by a signing authorization can besides supply a similar degree of confidence for the client application.

Easy apparatus and can be configured at web waiter. No extra cryptography is required.


Increased burden – Encrypting and decoding communicating is perceptibly more CPU-intensive than unencrypted communications

One issue with both TLS and SSL is that every petition requires extra back and forth communications to put up the secure socket. This operating expense can be minimized utilizing the Stateful connexion characteristic of HTTP 1.1. Though all REST executions take advantage of this attack to procure hallmark mechanisms like basic hallmark, the SSL or TSL security attack does non of course aline with the REST architecture. TLS secure Sessionss are user specific and keys are generated dynamically. The content is encrypted once more and once more as it travels via a unafraid tunnel doing it impossible to hoard this information as the web caches can non entree the informations inside the tunnel. However, clients having the content can copy it locally. This to a great extent reduces the scalability of the REST architectural manner for applications and services that require entree control to the informations and for this ground provide the informations through e.g. TLS tunnels or necessitate HTTP mandate.

“ The cardinal challenge with bing HTTP security theoretical accounts is that they offer IP-to-IP security solutions and non application-to-application 1s ”

Some Industry broad criterions for REST services security

OAuth ( OAuth Community Site )

Open Authorization ( OAuth ) is an unfastened criterion for mandate. It allows users to portion their private resources stored on one site with another site without holding to manus out their certificates, typically username and watchword.

OAuth allows users to manus out items alternatively of certificates to their informations hosted by a given service supplier. Each item grants entree to a specific site ( e.g. a picture redacting site ) for a specific resources ( e.g. merely videos from a specific album ) and for a defined continuance ( e.g. the following 2 hours ) . This allows a user to allow a 3rd party site entree to their information stored with another service supplier, without sharing their entree permissions or the full extent of their informations.

OAuth items are nil but session identifier. Interaction is non homeless between petitions in the OAuth nominal dialogue protocol as the petitions must be performed in a specific sequence and they do necessitate per-client storage on the waiter as demands to track things like when they were issued. So OAuth does go against the rigorous rules of a Restful architecture.

OAuth can be potentially used as an authorising mechanism to devour secured ( i.e. authenticated ) RSS/ATOM provenders. In general ingestion of RSS/ATOM provenders that requires hallmark has ever been an issue.

OAuth is a service that is complementary to, but distinguishable from, OpenID.

OpenID ( OpenID Foundation )

OpenID is an unfastened criterion that describes how users can be authenticated in a decentralized ( brokered hallmark ) mode, avoiding the demand for services to supply their ain ad hoc systems and leting users to consolidate their digital individualities.

Brokered hallmark criterions like OpenID accommodate RESTful web services for browser driven client or usage instances. However, they do n’t turn to RESTful service forms where individualities need to be propagated across nested service supplications, or any RESTful Web service client that is non browser based for that affair.


Current security theoretical accounts around HTTP are built to turn to the traditional petition response forms such as stateful communicating, server side Sessionss, and long connexion timeouts. whereas the REST attack brings its ain set of petition response paradigms such as statelessness, hoarding more petitions to the waiter ( than traditional web applications ) , non browser based clients etc. Furthermore REST services are widely used for API design unlike traditional web services. The bing HTTP security theoretical accounts in most of the instances cut down the REST service capablenesss ( for illustration, the SSL and REST caching mentioned above etc ) .

The current HTTP security attacks are non sufficient to turn to the security demands of REST services. Hence there is a definite demand to widen the bing HTTP security theoretical accounts to adequately turn to the specific demands for REST services and Web 2.0 applications.

Enterprises like OAuth and OpenID are really encouraging in footings of supplying security attacks for modern web applications. Supplying more infinite for inclusion of REST attack in these criterions will augment in conveying up standardisation of REST services security alternatively stoping up with multiple and custom security executions.


An entree control list ( ACL ) , with regard to a computing machine file system, is a list of permissions attached to an object. An ACL specifies which users or system procedures are given entree to objects, every bit good as what operations are allowed on given objects ( Access control list ( ACL ) )

Cross-site petition counterfeit, besides known as a one-click onslaught or session equitation and abbreviated as CSRF ( marked sea-surf ) or XSRF, is a type of malicious feat of a website whereby unauthorised bids are transmitted from a user that the website trusts. Unlike cross-site scripting ( XSS ) , which exploits the trust a user has for a peculiar site, CSRF exploits the trust that a site has in a user ‘s browser ( Cross-site scripting )

Cross-site scripting ( XSS ) is a type of computing machine security exposure typically found in web applications that enables malicious aggressors to shoot client-side book into web pages viewed by other users. An exploited cross-site scripting exposure can be used by aggressors to short-circuit entree controls such as the same beginning policy ( Cross-site petition counterfeit )

Message-Digest algorithm 5 ( MD5 ) is a widely used cryptanalytic hash map with a 128-bit ( 16-byte ) hash value. Specified in RFC 1321, MD5 has been employed in a broad assortment of security applications, and is besides normally used to look into the unity of files. ( MD5 ( Message-Digest algorithm 5 ) )

Rich Internet Application ( RIA ) is a web application that has many of the features of desktop applications, typically delivered either by manner of a site-specific browser, via a browser circuit board, independent sandboxes, or practical machines ( Rich Internet application ( RIA ) )


ACL Access Control List

API Application Programming interface

Atom The Atom Syndication Format

AWS Amazon Web Services

CA Certificate Authority

HMAC Hashing for Message Authentication codification

HTML Hypertext Markup Language

HTTP Hypertext Transfer Protocol

HTTPS Hypertext Transfer Protocol Secure

MitM Man-in-the-middle

POX Plain Old Xml

REST REpresentational State Transfer

RPC Remote process calls

RSS Really Simple Syndication

S3 Amazon Simple Storage Service

SSL Secure Socket Layer

TLS Transport Layer Security

URI Uniform Resource Identifier

XSS Cross-site scripting

Mentions and Recognitions

Restful Security by Dan Forsberg, Nokia Research Center, Helsinki, Finland dan.forsberg @, dforsber @

Representational State Transfer ( REST ) WiKi

RFC 1321 The MD5 Message-Digest Algorithm

RFC 2069 An Extension to HTTP: Digest Access Authentication

RFC 2616 Hypertext Transfer Protocol — HTTP/1.1

RFC 2617 HTTP Authentication: Basic and Digest Access Authentication

Why REST security does n’t be – Chris Comerford and Pete Soderling

Security for REST and Web 2.0 – Richard Mooney – Senior Solution Architect

OAuth Core 1.0

OAuth Security Advisory: 2009.1

Is OAuth 2.0 Bad for the Web?

Recognition of the OAuth security issue

Cross-site scripting ( XSS ) Wiki

Cross-site petition counterfeit Wiki

Rich Internet application

MD5 ( Message-Digest algorithm 5 )

Access control list ( ACL ) Wiki


I'm Niki!

Would you like to get a custom essay? How about receiving a customized one?

Check it out