Posts

Showing posts from May, 2018

Oauth - Social Login implementation

Image
Social Login with Oauth 2.0 Oauth 2.0 framework enable to get data from web servers with limited access to the 3rd party websites behalf of the resource owners.  There are several grant types to get data from resource servers  Authorization code grant type - for web apps that have back end servers Implicit grant type -  for client side scripts in web apps Client credentials grant type - server to server communications Resource owner password credentials grant type - for official apps like facebook mobile app etc.... in this example we use authorization code grant type lets starts the coding now. Step 1 - create facebook app go to the https://developers.facebook.com/ and create and app as follow. fill the relevant information go through the security check go tot the settings -> basic and copy the appID and the App secrete now you need to define what is the app domain . we are not going to host this app an...

Implement CSRF protection - Double submit token

Image
what is double submit token Cookies? as above figure when client login to the system server generates the CSRF token and store it in the client side (on cookie) when next reques goes to server, client embed the csrf token in to submit form and sends with CSRF token cookie. when server receive an request from client, it will validate user by comparering  both CSRF token field on the submit form and CSRF token cookie. How to implement ? In this web app there are 3 files  client side -> index.html  server side -> login.php                         sever.php step 1 -  login UI     you need to model simple its index.html this is the main page of the app. this is my index.html step 2 -  when user click log in data will send to server side (login.php) and authenticate user, start session  and set 2 cookies in client webbrowser 1 - Session cookie 2...

implement CSRF protection - Synchronizer token pattern

Image
what is synchronizer token pattern ?  as above figure, first client browser request login page and log in to the system. same time server generates CSRF token and store it on server side. next time user interact with the server, user ask server to send CSRF token with AJAX and user submit data along with CSRF token.  so server can verify this request came from legitimate user by comparing CSRF token received and own. How to implement ? In this web app there are 3 files  client side -> index.html  server side -> login.php                         sever.php step 1 - login UI     you need to model simple its index.html this is the main page of the app. this is my index.html step 2 -  when user click log in data will send to server side (login.php) and authenticate user.  then only if user authenticated client browser will create a new co...

CSRF protection for web apps

Image
CSRF - Cross Site Request Forgery  when users authenticated to the web service or app it will creates an session cookies and some other cookies to identify the user resubmit data to the server after authenticate process. Attackers are gain advantage of this process, they create an web page to  trick the users and get clicked to an link or button to submit data behalf of the users without known them. as and example - attacker create an malicious website that has a link saying "click this to win the price" but there are another hidden field that contain hidden data that attacker actually wants to post on your facebook status. but user don't see it. when user clicks on the link that hidden field data will be submitted to the facebook url as POST method. now the attacker successfully trick the user to put something attacker wants in as users facebook status. How to prevent CSRF there ate main two methods use in commonly to prevent csrf a...

Welcome to SL Cyber Geek

Hello there..  I am Sachin Ramesh, this is my personal blog about Information Technology. In this blog i am mainly focus on latest technologies of Information Technology, cyber Security aspects, and Software engineering aspects.