Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing req and payload #81

Merged
merged 29 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e475ed8
fixed toml
DeliciousBounty Sep 5, 2022
196df2e
fixed the path parameter
DeliciousBounty Sep 5, 2022
d8eaaf0
Bypass added
DeliciousBounty Sep 6, 2022
81259f2
Auth check added
DeliciousBounty Sep 11, 2022
58afe19
fixed object server
DeliciousBounty Sep 13, 2022
b6afca6
fixed object server
DeliciousBounty Sep 13, 2022
614f8e4
Added broken level authorization, severity fixed, path parameter supp…
DeliciousBounty Sep 18, 2022
900e655
Added broken level authorization, severity fixed, path parameter supp…
DeliciousBounty Sep 18, 2022
5bb3119
Beginning of BOLA
DeliciousBounty Sep 20, 2022
19301e5
fixed req.rs and ssl check
DeliciousBounty Sep 22, 2022
f6615f6
Added broken level authorization
DeliciousBounty Sep 22, 2022
5de6b5e
fixed create payload function ,fixed req.rs add severety
DeliciousBounty Sep 25, 2022
d4f1f90
remove prints
DeliciousBounty Oct 11, 2022
4824d86
Delete results.txt
RazMag Oct 18, 2022
8ca44c6
wrote new uri function
RazMag Oct 19, 2022
45b9ec0
Merge remote-tracking branch 'origin/fixing_req_and_payload' into fix…
RazMag Oct 24, 2022
0742fd9
passing clippy now
RazMag Oct 24, 2022
c43251b
fixing actions
RazMag Oct 25, 2022
79e37f6
using the new send_request_all_servers in check_min_max.
RazMag Nov 6, 2022
4bfa57a
more tests move to request_all_servers, still need to move the rest
RazMag Nov 14, 2022
a669297
all tests moved to use the new requester
RazMag Nov 14, 2022
b0ab0d0
removed the eq trait from almost everything it builds now
RazMag Nov 14, 2022
5c110bb
passing clippy on nightly
RazMag Nov 14, 2022
46676f4
adding rust toolchain files
RazMag Nov 14, 2022
0dec931
new version numbers
RazMag Nov 14, 2022
5f3cdf6
new swagger version in toml (cli)
RazMag Nov 14, 2022
951a6ff
added .idea to .gitignore
RazMag Nov 14, 2022
b5198c0
0.7.2
RazMag Nov 14, 2022
d52945c
0.7.2 now in the toml file too
RazMag Nov 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions .github/workflows/dev-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,32 @@ jobs:
command: fmt

cargo-clippy:
name: clippy
name: Clippy
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v2
- name: Install nightly
uses: actions-rs/toolchain@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: clippy

- name: cargo-clippy
env:
RUSTFLAGS: "-D warnings"
uses: actions-rs/cargo@v1
- uses: actions-rs/cargo@v1
with:
command: clippy

cargo-build:
name: build
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v2
- name: Install nightly
uses: actions-rs/toolchain@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true

- name: cargo-build
env:
RUSTFLAGS: "-A warnings"
uses: actions-rs/cargo@v1
- uses: actions-rs/cargo@v1
with:
command: build
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ Cargo.lock
./mapper
./attacker
./decider
/.idea

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cherrybomb"
version = "0.7.1"
version = "0.7.2"
authors = ["BLST Security"]
description = """
Cherrybomb is a CLI tool that helps you avoid undefined user behavior by validating your API specifications.
Expand Down Expand Up @@ -33,8 +33,8 @@ members = [
"swagger",
]
[dependencies]
cherrybomb-cli = "^0.7"
cherrybomb-swagger = "^0.1"
cherrybomb-cli = "^0.7.1"
cherrybomb-swagger = "^0.1.1"
clap = { version = "^3", features = ["derive"] }
uuid = { version = "0.8", features = ["v4","serde"] }
serde = { version = "^1.0", features = ["derive"] }
Expand Down
5 changes: 2 additions & 3 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cherrybomb-cli"
version = "0.7.0"
version = "0.7.1"
edition = "2021"
description = "A helper package for Cherrybomb"
license = "Apache-2.0"
Expand All @@ -19,8 +19,7 @@ serde_json = "1.0"
tokio = { version = "^1.0", features = ["full"] }
futures = "0.3"
futures-util = { version = "^0.3", default-features = false, features = ["alloc"] }
#cherrybomb-swagger = "^0.1"
cherrybomb-swagger = {path="../swagger"}
cherrybomb-swagger = "^0.1.1"
reqwest = { version = "^0.11",default_features = false, features = ["json","rustls-tls"] }
colored = "2.0.0"
url = { version = "2" }
Expand Down
2 changes: 2 additions & 0 deletions cli/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "nightly"
53 changes: 26 additions & 27 deletions cli/src/actions.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::collections::HashMap;
use super::*;
use std::collections::HashMap;
use swagger::scan::active::{ActiveScan, ActiveScanType};
use swagger::scan::passive::PassiveSwaggerScan;
use swagger::scan::Level;
use swagger::{Authorization, Check, EpTable, ParamTable, PassiveScanType, Swagger, OAS, OAS3_1};
use swagger::{Authorization, Check, EpTable, ParamTable, PassiveScanType, Swagger, OAS, OAS3_1, Server};

pub fn run_passive_swagger_scan<T>(
scan_try: Result<PassiveSwaggerScan<T>, &'static str>,
Expand All @@ -23,10 +23,10 @@ where
};
scan.run(passive_scan_type);
if json {
let mut out_json : HashMap<&str,Vec<swagger::scan::Alert>>= HashMap::new();
for check in scan.passive_checks.iter(){
let mut out_json: HashMap<&str, Vec<swagger::scan::Alert>> = HashMap::new();
for check in scan.passive_checks.iter() {
if !check.inner().is_empty() {
out_json.insert(check.name(),check.inner().clone());
out_json.insert(check.name(), check.inner().clone());
}
}
print!("{}", serde_json::to_string(&out_json).unwrap());
Expand Down Expand Up @@ -55,7 +55,8 @@ pub async fn run_active_swagger_scan<T>(
output_file: Option<String>,
auth: Authorization,
scan_type: ActiveScanType,
json:bool
json: bool,
_servers: Option<Vec<Server>>,
) -> Result<i8, &'static str>
where
T: OAS + Serialize + for<'de> Deserialize<'de> + std::fmt::Debug,
Expand All @@ -68,10 +69,10 @@ where
};
scan.run(scan_type, &auth).await;
if json {
let mut out_json : HashMap<&str,Vec<swagger::scan::Alert>>= HashMap::new();
for check in scan.checks.iter(){
let mut out_json: HashMap<&str, Vec<swagger::scan::Alert>> = HashMap::new();
for check in scan.checks.iter() {
if !check.inner().is_empty() {
out_json.insert(check.name(),check.inner().clone());
out_json.insert(check.name(), check.inner().clone());
}
}
print!("{}", serde_json::to_string(&out_json).unwrap());
Expand Down Expand Up @@ -103,13 +104,10 @@ pub async fn run_swagger(
no_active: bool,
active_scan_type: ActiveScanType,
passive_scan_type: PassiveScanType,
json: bool,
) -> i8 {
json: bool, ) -> i8 {
let (value, version) = if let Some((v1, v2)) = get_oas_value_version(file) {
(v1, v2)
} else {
return -1;
};
} else { return -1 };
if version.starts_with("3.") {
if json {
print!("{{\"passive checks\":");
Expand All @@ -128,19 +126,20 @@ pub async fn run_swagger(
if json {
print!(",\"active checks\":");
}
let active_result =
if !no_active {
run_active_swagger_scan::<OAS3_1>(
ActiveScan::<OAS3_1>::new(value.clone()),
verbosity,
output_file.clone(),
auth,
active_scan_type,
json,
).await
} else {
Ok(0)
};
let active_result = if !no_active && value.get("servers").is_some() {
run_active_swagger_scan::<OAS3_1>(
ActiveScan::<OAS3_1>::new(value.clone()),
verbosity,
output_file.clone(),
auth,
active_scan_type,
json,
None, // TODO ADD SUPPORT FOR SERVERS FROM CONFIG
)
.await
} else {
Ok(0)
};
if let Err(e) = active_result {
print_err(e);
return -1;
Expand Down
Loading