Code Monkey home page Code Monkey logo

zest's Introduction

ZAP Zest

Zest is a specialized scripting language (initially) developed by the Mozilla security team and is intended to be used in web orientated security tools.

It is completely free, open source and can be included in any tool whether open or closed, free or commercial.

Version 1 of Zest:

  • Is aimed at creating scripts for reproducing basic security vulnerabilities
  • Includes a java reference implementation
  • Has been included in a proof-of-concept ZAP add-on

For more details see the wiki: https://github.com/zaproxy/zest/wiki

How to Obtain

If using a dependency management tool, for example Maven or Gradle, the zest library can be obtained from Maven Central with following coordinates:

  • GroupId: org.zaproxy
  • ArtifactId: zest

Building

The project uses Gradle to build, for example, running:

./gradlew build

in the main directory of the project will build the library, located under build/libs, and create a standalone command line application (library + dependencies), located under build/distributions/.

zest's People

Contributors

aryangupta701 avatar bkimminich avatar cosminstefanxp avatar denniskniep avatar kingthorin avatar mgmechanics avatar mozilla-github-standards avatar mozmark avatar psiinon avatar ricekot avatar seccoale avatar thc202 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zest's Issues

JUnit integration

It should be easy to create a JUnit test from a Zest script, eg using a simple wrapper?

Command line JSON output

Scripts run from the command line should output in JSON, or at the very least have an option to do this.

Allow a simple text matching condition

A simple text match would be useful for those cases where you simply want to see if a specific piece of HTML is in a response or not. This can also be done with a regex of course but then you have to carefully escape all the funny characters which is error prone.

some type of variable names not accepted

Only alpha numeric variable names seems to be accepted as a variable names in Zest. However, some applications such DWR do require to have variable names other than alphanumeric (ex:c0-e1).
Can this be addressed?

Add Loops

Add a new generic element type to represent loops.
Should also add elements to break and continue.
Initial implementations should also be made for looping through a list of specified values and looking through a set of values read from a specified file, as well as one for looping through integer values (start, end, step).
In all cases a specified token should be set to the value in the loop.

There should be no theoretical limit to the depth of loops possible (although there will be practical / sensible limits)

Add Action: intercept

To be used by MitM proxies (like ZAP;) to allow Zest scripts to intercept / break on requests and responses

Add a condition to execute a regular expression on the value of a header

I think this condition should do two things:

  • check if the header exists, and fail if it does not
  • match the regular expression against the header value

It should find the header case insensitive. So a condition that works on X-Frame-Options should find x-frame-options.

One issue here is that multiple headers with the same name are allowed. For example it is not uncommon to have multiple Set-Cookie headers in the same response. Not sure how to deal with that. Maybe apply the regex to all the headers?

Change transforms into assigns

The current Transformations should be changed into 'Assignations".
So (for example) the ZestTransformFieldReplace would be replaced with an Assign which would set a specified token to the value of the field - which could be extracted via a ZestFieldDefinition, a regex etc etc
The field value could then be replaced by the token in future requests.
I think this is more flexible and hopefully logical.

Regex loop

Add a loop which loops through regex matches on a specifioed variable

ZestConditional.deepCopy broken

The Then and Else statements are not copies, which breaks a whole load of things, including cut-n-paste in the ZAP add-on.

Implement 'standard' tokens

Define, implement and document a 'standard' set of tokens which are supported by the runtime.
Things like:

  • request - the whole of the last request
  • request.url - the last request url
  • request.header - etc
  • request.body
  • response - the whole of the last response
  • response.header
  • response.body
  • target.url - the target url for active (and generic?) scripts
  • target.request - the whole of the target request
  • target.param - the target parameter for active scripts
  • target.value - the 'current' target value (expected to be replaced)

All relevant Zest elements should change to use these tokens instead of the current mechanisms

Text representations

All elements should define a standard text representation, so that we dont end up with different implementations using different notations.
In theory someone could write a parser for these :)

Error while running from Command-line

./zest.sh -script ../examples/BodgeIt_Register_XSS.zst

Error loading script /Users/dscarson/Documents/zest-master/dist/../examples/BodgeIt_Register_XSS.zst: com.google.gson.JsonParseException: java.lang.ClassNotFoundException: org.mozilla.zest.core.v1.ZestConditionRegex

Add TransformRandomTextReplace

As per the 'Int' one already added, but should allow rnadom 'sentances' to be built up.
eg
minWords
maxWords
minLettersPerWord
maxLettersPerWord

maybe even support different character sets?

Support complex conditional expressions

ZestConditional should be made 'final' and use ZestExpression - this would be extended as per the current conditionals plus things like ZestExpressionOr and ZestExpressionAnd.
This will allow complex expressions to be built up.

ZestAssignRegexDelimiters fails with Null Pointer Exception

Executing ZestAssignRegexDelimiters statement, like the one below, fails with null pointer exception.

{
   "prefix": "/DOCTYPE/",
   "postfix": "/en/",
   "location": "BODY",
   "variableName": "rr",
   "index": 5,
   "enabled": true,
   "elementType": "ZestAssignRegexDelimiters"
}
Result:

java.lang.NullPointerExceptionjava.lang.NullPointerException

Some expressions wont work on requests

Some of the expressions will only work on responses, when they should really work on requests, such as the URL matching.
This means that 'proxy' scripts using these expressions typically wont work as the script runs against the requests and responses separately.

Zest: Multipart/form-data request failed

t seems that there is an issues if we modify any value/or use variable inside multipart-data body (inside visual dialog box)
The carriage return \r is remove. If we keep original request without any parameter value modification, it works.

example,

==> Initial request in dialog box.

-----------------------------23807238975742
Content-Disposition: form-data; name="state"

id1
-----------------------------23807238975742--

==> Inside script console
-----------------------------23807238975742\r\nContent-Disposition: form-data; name="state"\r\n\r\nid1\r\n-----------------------------23807238975742--\r\n

==> modify the request and use variable

-----------------------------23807238975742
Content-Disposition: form-data; name="state"

{{value1}}
-----------------------------23807238975742--

==> Inside script console
-----------------------------23807238975742\r\nContent-Disposition: form-data; name="state"\r\n\r\n{{value1}}\n-----------------------------23807238975742--\r\n

As on the above after variable replacement carriage return \r is disappear due to that multipart request fail or not work. If add manual \r after parameter modification it works.

\r must add after any kind of modification on parameter value.

Optionally do not store response data in a script

Zest scripts can become very large if they also contain the response data. One of my tests is a 250KB JSON blob because it contains all the response bodies. I think in many cases storing the response data is not needed at all.

This would also make scripts much more lightweight and easier to embed in for example Minion.

Embedded Zest scripts

Support a new element which would invoke the named Zest script.
This will allow users to create smaller scripts which perform specific tasks.

Allow checking the request protocol

We need a way to test if the protocol used for a previous request was using HTTPS.
This would allow us to write conditions for tests against HSTS, mixed-content and the secure flag on cookies.

Follow redirection for POST request

Hi,

Currently redirection follow is only possible for GET request. The redirection is not possible for POST.
It would be really useful to have redirection on POST method.

Can you add this feature in Zest?

Kr,
Ph

Change to majorVersion 0 minorVersion *

Zest is currently experimental and subject to significant change.
Should really be version '0' to indicate this, and introduce a 'minorVersion' to designate iterations within this

Record and replay request headers

I had a Zest script failing on me because it did not include the Accept: header. As a response the server returned a text/plain response instead of the original HTML document that I saw in ZAP.

Maybe there should be a default set of headers that Zest should always take and replay to make the request look as much as possible as one coming from a browser? How about at least User-Agent:, Accept:, Accept-Language:, Accept-Encoding: ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.