Security Test Your API Endpoints With Pynt

Security Test Your API Endpoints With Pynt

Have you ever been worried about the security of your API endpoints? This is the question that raises in our minds very few times. The reason behind this is very simple, nobody cares about security until an incident happens. In DishHome and in dish home ott API had been compromised. A bug bounty is given to the person who has given information about security flaws in our API. It is obvious that when you are a junior developer you focus most of your time on how to do it rather than how to secure it. If you really don't know how to do it then what you are going to secure at all? When you are a beginner you write code to login, code to generate bearer tokens and you ignore all the details behind you. That step might be good because when you are learning, it may be overwhelming when you focus a lot on details because you have to learn to make things work first. But once you become confident in doing such work then you need to start to focus on security factors also. If you don't limit the rate of generation of bearer tokens then users may keep on generating tokens which may over-traffic our web servers. Every year top 10 security vulnerabilities are listed on the OWASP website which is also called OWASP 10 vulnerabilities. OWASP 10 commonly consists of security threats like broken authentication, SQL injections, cross-site request forgery, and many others.

In this article, I going to guide you to get started with pynt to security test your API. So, you are thinking what a hell is in the earth is pynt. Pynt is a free API security solution that generates automated security tests from your existing functional test collection in a few minutes. Pynt (pynt.io) is a free API security solution that runs seamlessly in Postman. It generates automated security tests based on your existing functional test collection. Simply input your functional test collection name into the Pynt collection and run it to get the security testing coverage for your

Tools you need to install

  1. Ensure you are working with the Postman app (install from https://www.postman.com/downloads). Please note that the Pynt solution is based on docker and requires access to the local host, so it doesn't support the Postman web.

  2. Ensure the Docker engine is available and running on your machine (install it from: https://docs.docker.com/engine/install/).

Getting Started:

  • Open your workspace from the Postman desktop app.

  • Download and run the Pynt docker by executing the following command (port number can be changed if already taken):

This step should be repeated if you restarted your PC.

Run%20Pynt%20docker

Run Pynt docker

How to Run:

Make sure Pynt's docker is still up.

  • Click on the 'Variables' tab of the 'Pynt' collection and fill in the values of the required parameters, in the 'CURRENT VALUE' column:

    • API-KEY - your postman API key - If you previously saved and have your API key, enter it here under the 'Current Value' tab. If not, enter https://postman.co/settings/me/api-keys to generate or regenerate your API key as for security reasons it can only be copied at the time of creation. You won't need to modify this parameter again until the API-key expires.

    • PYNT-PORT - the left port number used in the docker run command (default-5001).

    • YOUR-COLLECTION- your functional test collection name, or the collection UID (both are acceptable, UID is preferred if you have two collections with the same name associated with the API-KEY). Pynt will refer to this collection to generate the automated security tests.
      If you wish to have a reference application to test, Pynt provides a vulnerable app example called 'goat' that you can fork from Pynt's public workspace: https://www.postman.com/pynt-io/workspace/pynt and use it here.

    • scanId - output variable, used internally. Ignore.

    • Click 'Save'.

  • Run the 'Pynt' collection to get the security results:

    • The security results for OWASP-10 categories will appear on the main console screen.

    • Click on 'View Summary' to view the results summary.

    • In order to see the full report, uncollapse the 'Pynt' collection, go to the last request 'Show Report' and click on 'Send'. choose the 'Visualize' tab on the lower section to see the full report.

If you modified your test collection in any way, simply re-run Pynt collection. Should you need to test another collection, simply update the YOUR-COLLECTIONvariable and re-run the 'Pynt' collection.

See also screenshot examples:

Image%201%20-%20Generate/copy%20API%20Key%20if%20forgotten

Image 1 - Generate/copy API Key if forgotten

Image%202%20-%20Enter%20'Pynt'%20collection%20parameters

Image 2 - Enter 'Pynt' collection parameters

Image%203%20-%20Run%20the%20'Pynt'%20collection%20to%20generate%20full%20OWASP-10%20API-security%20tests%20for%20your%20collection

Image 3 - Run the 'Pynt' collection to generate full OWASP-10 API-security tests for your collection

Image%204%20-%20View%20the%20API%20security%20test%20results

Image 4 - View the API security test results

Image%205%20-%20View%20results%20summary

Image 5 - View results summary

Image%206%20-%20View%20visualize%20report%20for%20security%20summary

Image 6 - View visualize report for security summary

Image%207%20-%20View%20visualize%20report%20for%20detailed%20findings

Image 7 - View visualize report for detailed findings