2

ZAP provides a way to turn a login (POST) request into a logging pattern (through the "mark as ..." in context menu).

When the data is something like "user=toto&psswd=t@T°", it will translate it into

"user={%username%}&psswd={%password%}"

after you told it about the keywords user and psswd.

But when your data is a json object such as {"user":"toto","psswd":"t@T°"}, and even though the content-type of the original request specifies it, ZAP will be unable to detect what keyword can be used, and will propose {"user":"toto","psswd":"t@T°"} as both username and password keyword... thus preventing you from defining a correct login pattern.

Do you know of a tip to process through form-based authentication with ZAP?

1 Answer 1

1

Unfortunately at this time there is an outstanding feature request for handling authentication via a JSON Object: https://github.com/zaproxy/zaproxy/issues/2439

One alternative is to record a scripted authentication.


Update:

The previously discussed functionality is now available: https://github.com/zaproxy/zaproxy/pull/4624

If you want to use it, you'll either have to use a weekly: https://github.com/zaproxy/zaproxy/wiki/Downloads#zap-weekly

Or, wait for the next full release (likely 2.8.0).

The corresponding PR to update the help content for the new JSON Authentication functionality is here: https://github.com/zaproxy/zap-core-help/pull/188/files if you want to check it out.

You set it up the same way you would for form based authentication. Make sure you define a Logged-in or Logged-out Identifier (or both). Here's some screenshots to help you along:

Manually configure the Authentication for your Context: Context Authentication Settings

Use the Site Tree Context menu(s) to set it up: Flag a JSON request as the Context's "Login Request"

Select the associated username and password fields

Here's an additional help link that might assist you in getting authentication setup: https://github.com/zaproxy/zaproxy/wiki/FAQformauth

3
  • I should have looked further into issues. Thanks for pointing out the request and the alternative as well!
    – Marvin
    Commented Mar 15, 2018 at 11:34
  • 1
    Hey Marvin, the functionality is now a available. I've updated the answer.
    – kingthorin
    Commented May 5, 2018 at 7:39
  • That's awesome! I'll try it asap! Thanks for the information
    – Marvin
    Commented May 14, 2018 at 7:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .