Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd7435cc68 | ||
|
|
bcc4178e89 | ||
|
|
0ff945ef65 |
No files matched your search
@@ -4,6 +4,11 @@
|
|||||||
|
|
||||||
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow SemVer.
|
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow SemVer.
|
||||||
|
|
||||||
|
## [1.0.6] - 2026-11-03
|
||||||
|
|
||||||
|
### Security
|
||||||
|
- **`sabia ui` token is now unguessable.** It was the server's startup time in nanoseconds, so another user or process on the same machine could find it by trying values around that moment and then drive the API (captures, deauthentication, Evil Twin). It is now 32 random bytes from the operating system, and requests are checked in constant time. The desktop app does not use this token and is unaffected.
|
||||||
|
|
||||||
## [1.0.5] - 2026-10-31
|
## [1.0.5] - 2026-10-31
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
|
|
||||||
Formato baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/); versões seguem SemVer.
|
Formato baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/); versões seguem SemVer.
|
||||||
|
|
||||||
|
## [1.0.6] - 2026-11-03
|
||||||
|
|
||||||
|
### Segurança
|
||||||
|
- **O token do `sabia ui` agora não pode ser adivinhado.** Ele era o horário de partida do servidor em nanossegundos, então outro usuário ou processo na mesma máquina podia achá-lo testando valores próximos daquele momento e passar a comandar a API (capturas, desautenticação, Evil Twin). Agora são 32 bytes aleatórios do sistema operacional, e as requisições são conferidas em tempo constante. O app desktop não usa esse token e não é afetado.
|
||||||
|
|
||||||
## [1.0.5] - 2026-10-31
|
## [1.0.5] - 2026-10-31
|
||||||
|
|
||||||
### Adicionado
|
### Adicionado
|
||||||
|
|||||||
Generated
+3
-2
@@ -440,10 +440,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sabia-cli"
|
name = "sabia-cli"
|
||||||
version = "1.0.5"
|
version = "1.0.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"ctrlc",
|
"ctrlc",
|
||||||
|
"getrandom",
|
||||||
"sabia-core",
|
"sabia-core",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -451,7 +452,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sabia-core"
|
name = "sabia-core"
|
||||||
version = "1.0.5"
|
version = "1.0.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"flate2",
|
"flate2",
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "2"
|
|||||||
members = ["crates/sabia-core", "crates/sabia-cli"]
|
members = ["crates/sabia-core", "crates/sabia-cli"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "1.0.5"
|
version = "1.0.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
repository = "https://git.lucasrguerra.dev.br/ciberfauna/sabia"
|
repository = "https://git.lucasrguerra.dev.br/ciberfauna/sabia"
|
||||||
|
|||||||
Generated
+2
-2
@@ -2538,7 +2538,7 @@ checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sabia-core"
|
name = "sabia-core"
|
||||||
version = "1.0.5"
|
version = "1.0.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"flate2",
|
"flate2",
|
||||||
@@ -2555,7 +2555,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sabia-gui"
|
name = "sabia-gui"
|
||||||
version = "1.0.5"
|
version = "1.0.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"sabia-core",
|
"sabia-core",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sabia-gui"
|
name = "sabia-gui"
|
||||||
description = "Sabiá: graphical Wi-Fi security auditing interface"
|
description = "Sabiá: graphical Wi-Fi security auditing interface"
|
||||||
version = "1.0.5"
|
version = "1.0.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
authors = ["Sabiá contributors"]
|
authors = ["Sabiá contributors"]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "Sabiá",
|
"productName": "Sabiá",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"identifier": "dev.sabia.app",
|
"identifier": "dev.sabia.app",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../ui"
|
"frontendDist": "../ui"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ name = "sabia"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
getrandom = "0.4"
|
||||||
sabia-core = { path = "../sabia-core" }
|
sabia-core = { path = "../sabia-core" }
|
||||||
clap = { version = "4", features = ["derive"] }
|
clap = { version = "4", features = ["derive"] }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use std::io::{BufRead, BufReader, Read, Write};
|
|||||||
use std::net::{TcpListener, TcpStream};
|
use std::net::{TcpListener, TcpStream};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
|
||||||
|
|
||||||
const INDEX_HTML: &str = include_str!("../../../../apps/gui/ui/index.html");
|
const INDEX_HTML: &str = include_str!("../../../../apps/gui/ui/index.html");
|
||||||
const APP_CSS: &str = include_str!("../../../../apps/gui/ui/app.css");
|
const APP_CSS: &str = include_str!("../../../../apps/gui/ui/app.css");
|
||||||
@@ -54,12 +53,27 @@ pub fn serve(port: u16, audit_path: std::path::PathBuf, open: bool) -> sabia_cor
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 32 bytes from the operating system's CSPRNG, hex-encoded. The token used to
|
||||||
|
/// be the startup time in nanoseconds, which anyone on the machine could guess
|
||||||
|
/// within a small window and use to drive the API (captures, deauth, Evil Twin).
|
||||||
fn gen_token() -> String {
|
fn gen_token() -> String {
|
||||||
let nanos = SystemTime::now()
|
let mut bytes = [0u8; 32];
|
||||||
.duration_since(UNIX_EPOCH)
|
getrandom::fill(&mut bytes).expect("operating system random number generator");
|
||||||
.unwrap_or_default()
|
bytes.iter().map(|b| format!("{b:02x}")).collect()
|
||||||
.as_nanos();
|
}
|
||||||
format!("{nanos:x}")
|
|
||||||
|
/// Constant-time check, so response timing does not reveal how much of a
|
||||||
|
/// guess was right.
|
||||||
|
fn token_ok(candidate: Option<&str>, expected: &str) -> bool {
|
||||||
|
let Some(candidate) = candidate else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
let (candidate, expected) = (candidate.as_bytes(), expected.as_bytes());
|
||||||
|
let mut diff = candidate.len() ^ expected.len();
|
||||||
|
for (index, byte) in expected.iter().enumerate() {
|
||||||
|
diff |= usize::from(byte ^ candidate.get(index).copied().unwrap_or(0));
|
||||||
|
}
|
||||||
|
diff == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
@@ -230,7 +244,7 @@ fn handle(
|
|||||||
let req = parse_request(&mut stream)?;
|
let req = parse_request(&mut stream)?;
|
||||||
|
|
||||||
if req.path == "/" {
|
if req.path == "/" {
|
||||||
if req.token.as_deref() != Some(expected_token) {
|
if !token_ok(req.token.as_deref(), expected_token) {
|
||||||
return respond(&mut stream, 401, "text/plain", b"token invalido");
|
return respond(&mut stream, 401, "text/plain", b"token invalido");
|
||||||
}
|
}
|
||||||
return respond(
|
return respond(
|
||||||
@@ -242,7 +256,7 @@ fn handle(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if req.path == "/api/report.html" {
|
if req.path == "/api/report.html" {
|
||||||
if req.token.as_deref() != Some(expected_token) {
|
if !token_ok(req.token.as_deref(), expected_token) {
|
||||||
return respond(&mut stream, 401, "text/plain", b"token invalido");
|
return respond(&mut stream, 401, "text/plain", b"token invalido");
|
||||||
}
|
}
|
||||||
let Some(iface) = req.text("iface") else {
|
let Some(iface) = req.text("iface") else {
|
||||||
@@ -315,7 +329,7 @@ fn handle(
|
|||||||
if !req.path.starts_with("/api/") {
|
if !req.path.starts_with("/api/") {
|
||||||
return respond(&mut stream, 404, "text/plain", b"not found");
|
return respond(&mut stream, 404, "text/plain", b"not found");
|
||||||
}
|
}
|
||||||
if req.token.as_deref() != Some(expected_token) {
|
if !token_ok(req.token.as_deref(), expected_token) {
|
||||||
return respond(
|
return respond(
|
||||||
&mut stream,
|
&mut stream,
|
||||||
401,
|
401,
|
||||||
@@ -834,6 +848,25 @@ fn api(engine: &Arc<Engine>, req: &Request) -> (u16, String) {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tokens_are_random_and_long() {
|
||||||
|
let (a, b) = (gen_token(), gen_token());
|
||||||
|
assert_eq!(a.len(), 64);
|
||||||
|
assert!(a.bytes().all(|c| c.is_ascii_hexdigit()));
|
||||||
|
assert_ne!(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn token_check_needs_the_exact_value() {
|
||||||
|
assert!(token_ok(Some("abc123"), "abc123"));
|
||||||
|
assert!(!token_ok(Some("abc12"), "abc123"));
|
||||||
|
assert!(!token_ok(Some("abc1234"), "abc123"));
|
||||||
|
assert!(!token_ok(Some("abc124"), "abc123"));
|
||||||
|
assert!(!token_ok(None, "abc123"));
|
||||||
|
assert!(!token_ok(Some(""), "abc123"));
|
||||||
|
}
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -402,7 +402,10 @@ section.chapter:first-of-type { break-before: avoid; }
|
|||||||
.cover .brand { display: flex; align-items: center; gap: 3mm; }
|
.cover .brand { display: flex; align-items: center; gap: 3mm; }
|
||||||
.cover .brand img { width: 11mm; height: 11mm; border-radius: 3mm; display: block; }
|
.cover .brand img { width: 11mm; height: 11mm; border-radius: 3mm; display: block; }
|
||||||
.cover .brand span { font-family: var(--display); font-size: 14pt; font-weight: 700; letter-spacing: -0.01em; }
|
.cover .brand span { font-family: var(--display); font-size: 14pt; font-weight: 700; letter-spacing: -0.01em; }
|
||||||
|
.cover .badges { display: flex; align-items: center; gap: 2.5mm; }
|
||||||
.cover .badge { font: 700 8pt var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #ffd38a; border: 1px solid #a66a2e; background: rgba(255,211,138,.08); padding: 2.5mm 4mm; border-radius: 1mm; white-space: nowrap; }
|
.cover .badge { font: 700 8pt var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #ffd38a; border: 1px solid #a66a2e; background: rgba(255,211,138,.08); padding: 2.5mm 4mm; border-radius: 1mm; white-space: nowrap; }
|
||||||
|
/* FIRST.org TLP 2.0 brand color (amber), matching the sharing-classification badge the Ciberfauna report convention requires. */
|
||||||
|
.cover .badge-tlp { color: #FFC000; border-color: #FFC000; background: rgba(255,192,0,.08); }
|
||||||
.cover .mid { margin-top: auto; }
|
.cover .mid { margin-top: auto; }
|
||||||
.cover .eyebrow { color: #ffb963; margin-bottom: 4mm; }
|
.cover .eyebrow { color: #ffb963; margin-bottom: 4mm; }
|
||||||
.cover h1 { font-size: 40pt; letter-spacing: -0.02em; max-width: 150mm; color: #fff; margin-bottom: 6mm; }
|
.cover h1 { font-size: 40pt; letter-spacing: -0.02em; max-width: 150mm; color: #fff; margin-bottom: 6mm; }
|
||||||
@@ -484,7 +487,7 @@ tbody tr:nth-child(even) td { background: #f7f9f7; }
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
@top-left { content: "SABIÁ · AUDITORIA WI-FI"; font: 600 7.5pt var(--mono); letter-spacing: .1em; color: var(--faint); vertical-align: bottom; padding-bottom: 4mm; }
|
@top-left { content: "SABIÁ · AUDITORIA WI-FI"; font: 600 7.5pt var(--mono); letter-spacing: .1em; color: var(--faint); vertical-align: bottom; padding-bottom: 4mm; }
|
||||||
@top-center { content: string(section); font: 500 7.5pt var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); vertical-align: bottom; padding-bottom: 4mm; text-align: center; }
|
@top-center { content: string(section); font: 500 7.5pt var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); vertical-align: bottom; padding-bottom: 4mm; text-align: center; }
|
||||||
@top-right { content: "\25CF USO AUTORIZADO"; font: 700 7.5pt var(--mono); letter-spacing: .1em; color: var(--accent); vertical-align: bottom; padding-bottom: 4mm; text-align: right; white-space: nowrap; }
|
@top-right { content: "TLP:AMBER \25CF USO AUTORIZADO"; font: 700 7.5pt var(--mono); letter-spacing: .1em; color: var(--accent); vertical-align: bottom; padding-bottom: 4mm; text-align: right; white-space: nowrap; }
|
||||||
@bottom-left { content: string(footline); font: 400 7.5pt var(--mono); color: var(--faint); vertical-align: top; padding-top: 4mm; }
|
@bottom-left { content: string(footline); font: 400 7.5pt var(--mono); color: var(--faint); vertical-align: top; padding-top: 4mm; }
|
||||||
@bottom-right { content: counter(page) " / " counter(pages); font: 700 8pt var(--mono); color: var(--ink); vertical-align: top; padding-top: 4mm; text-align: right; }
|
@bottom-right { content: counter(page) " / " counter(pages); font: 700 8pt var(--mono); color: var(--ink); vertical-align: top; padding-top: 4mm; text-align: right; }
|
||||||
}
|
}
|
||||||
@@ -549,7 +552,7 @@ pub fn render(model: &ReportModel, options: ReportOptions) -> String {
|
|||||||
<section class="cover">
|
<section class="cover">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div class="brand"><img src="{logo}" alt=""><span>Sabiá</span></div>
|
<div class="brand"><img src="{logo}" alt=""><span>Sabiá</span></div>
|
||||||
<span class="badge">Uso autorizado</span>
|
<div class="badges"><span class="badge badge-tlp">TLP:AMBER</span><span class="badge">Uso autorizado</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mid">
|
<div class="mid">
|
||||||
<p class="eyebrow">Relatório de auditoria · redes sem fio</p>
|
<p class="eyebrow">Relatório de auditoria · redes sem fio</p>
|
||||||
|
|||||||
Reference in new issue
Block a user