百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

race-the-web

> DevOps
开源

测试 Web 应用程序中的竞争条件。包括可集成到持续集成管道中的 RESTful API。

634 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

测试 Web 应用程序中的竞争条件。包括可集成到持续集成管道中的 RESTful API。

Race The Web (RTW)

Tests for race conditions in web applications by sending out a user-specified number of requests to a target URL (or URLs) simultaneously, and then compares the responses from the server for uniqueness. Includes a number of configuration options.

UPDATE: Now CI Compatible!

Version 2.0.0 now makes it easier than ever to integrate RTW into your continuous integration pipeline (à la Jenkins, Travis, or Drone), through the use of an easy to use HTTP API. More information can be found in the Usage section below.

Watch The Talk

Racing the Web - Hackfest 2016

Slides: https://www.slideshare.net/AaronHnatiw/racing-the-web-hackfest-2016

Usage

With configuration file

bash
$ race-the-web config.toml

API

bash
$ race-the-web

Configuration File

Example configuration file included (config.toml):

…

TOML Spec: https://github.com/toml-lang/toml

API

Since version 2.0.0, RTW now has a full-featured API, which allows you to easily integrate it into your continuous integration (CI) tool of choice. This means that you can quickly and easily test your web application for race conditions automatically whenever you commit your code.

The API works through a simple set of HTTP calls. You provide input in the form of JSON and receive a response in JSON. The 3 API endpoints are as follows:

  • POST http://127.0.0.1:8000/set/config: Provide configuration data (in JSON format) for the race condition test you want to run (examples below).
  • GET http://127.0.0.1:8000/get/config: Fetch the current configuration data. Data is returned in a JSON response.
  • POST http://127.0.0.1:8000/start: Begin the race condition test using the configuration that you have already provided. All findings are returned back in JSON output.

Example JSON configuration (sent to /set/config using a POST request)

json
{
    "count": 100,
    "verbose": false,
    "requests": [
        {
            "method": "POST",
            "url": "http://racetheweb.io/bank/withdraw",
            "cookies": [
                "sessionId=dutwJx8kyyfXkt9tZbboT150TjZoFuEZGRy8Mtfpfe7g7UTPybCZX6lgdRkeOjQA"
            ],
            "body": "amount=1",
            "redirects": true
        }
    ]
}

Example workflow using curl

  1. Send the configuration data
bash
$ curl -d '{"count":100,"verbose":false,"requests":[{"method":"POST","url":"http://racetheweb.io/bank/withdraw","cookies":["sessionId=Ay2jnxL2TvMnBD2ZF-5bXTXFEldIIBCpcS4FLB-5xjEbDaVnLbf0pPME8DIuNa7-"],"body":"amount=1","redirects":true}]}' -H "Content-Type: application/json" -X POST http://127.0.0.1:8000/set/config

{"message":"configuration saved"}
  1. Retrieve the configuration data for validation
bash
$ curl -X GET http://127.0.0.1:8000/get/config

{"count":100,"verbose":false,"proxy":"","requests":[{"method":"POST","url":"http://racetheweb.io/bank/withdraw","body":"amount=1","cookies":["sessionId=Ay2jnxL2TvMnBD2ZF-5bXTXFEldIIBCpcS4FLB-5xjEbDaVnLbf0pPME8DIuNa7-"],"headers":null,"redirects":true}]}
  1. Start the race condition test
bash
$ curl -X POST http://127.0.0.1:8000/start

Response (expanded for visibility):

…

Binaries

The program has been written in Go, and as such can be compiled to all the common platforms in use today. The following architectures have been compiled, and can be found in the releases tab:

  • Windows amd64
  • Windows 386
  • Linux amd64
  • Linux 386
  • OSX amd64
  • OSX 386

Compiling

First, make sure you have Go installed on your system. If you don't you can follow the install instructions for your operating system of choice here: https://golang.org/doc/install.

Build a binary for your current CPU architecture

bash
$ make build

Build for all major CPU architectures (see Makefile for details) at once

bash
$ make

Dep

This project uses Dep for dependency management. All of the required files are kept in the vendor directory, however if you are getting errors related to dependencies, simply download Dep

bash
$ go get -u github.com/golang/dep/cmd/dep

and run the following command from the RTW directory in order to download all dependencies

bash
$ dep ensure

Go 1.7 and newer are supported

Before 1.7, the encoding/json package's Encoder did not have a method to escape the &, `` characters; this is required in order to have a clean output of full HTML pages when running these race tests. If this is an issue for your test cases, please submit a new issue indicating as such, and I will add a workaround (just note that any output from a server with those characters will come back with unicode escapes instead). Here are the relevant release details from Go 1.7: https://golang.org/doc/go1.7#encoding_json.

The Vulnerability

A race condition is a flaw that produces an unexpected result when the timing of actions impact other actions. An example may be seen on a multithreaded application where actions are being performed on the same data. Race conditions, by their very nature, are difficult to test for.

  • OWASP

Race conditions are a well known issue in software development, especially when you deal with fast, multi-threaded languages.

However, as network speeds get faster and faster, web applications are becoming increasingly vulnerable to race conditions. Often because of legacy code that was not created to handle hundreds or thousands of simultaneous requests for the same function or resource.

The problem can often only be discovered when a fast, multi-threaded language is being used to generate these requests, using a fast network connection; at which point it becomes a network and logic race between the client application and the server application.

That is where Race The Web comes in. This program aims to discover race conditions in web applications by sending a large amount of requests to a specific endpoint at the same time. By doing so, it may invoke unintended behaviour on the server, such as the duplication of user information, coupon codes, bitcoins, etc.

Warning: Denial of service may be an unintended side-effect of using this application, so please be careful when using it, and always perform this kind of testing with the explicit permission of the server owner and web application owner.

Credit goes to Josip Franjković for his excellent article on the subject, which introduced me to this problem.

Why Go

The Go programming language is perfectly suited for the task, mainly because it is so damned fast. Here are a few reasons why:

  • Concurrency: Concurrency primitives are built into the language itself, and extremely easy to add to any Go program. Threading is handled by the Go runtime scheduler, and not by the underlying operating system, which allows for some serious performance optimizations when it comes to concurrency.
  • Compiled: Cross-compiles to most modern operating systems; not slowed down by an interpreter or virtual machine middle-layer (here are some benchmarks vs Java). (Oh, and did I mention that the binaries are statically compiled?)
  • Lightweight: Only 25 keywords in the language, and yet still almost everything can be done using the standard library.

For more of the nitty-gritty details on why Go is so fast, see Dave Cheney's excellent talk on the subject, from 2014.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goappsecdevops-toolsinfosecrace-conditions

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理