Skip to content

[repo-monitor] High: Path traversal via spider.name() — ../sequences write to arbitrary filesystem paths #2

@Liohtml

Description

@Liohtml

Summary

spider.name() is interpolated directly into filesystem paths for cache and checkpoint directories without sanitization. A spider name containing ../ enables path traversal to write outside the .scrapling/ directory.

Location

  • File: src/spiders/engine.rs
  • Line(s): 50–60

Severity

High

Details

.unwrap_or_else(|| format!(".scrapling/{}/cache", spider.name()));
.unwrap_or_else(|| format!(".scrapling/{}/checkpoints", spider.name()));

If a spider name contains ../ (e.g., "../../etc/cron.d"), create_dir_all and subsequent file writes would target arbitrary filesystem locations.

Suggested Fix

Sanitize the spider name before use:

let safe_name = spider.name().replace(['/', '\\', '.'], "_");
let dir = format!(".scrapling/{}/cache", safe_name);

Or validate using Path::new(name).components() to ensure no .. or root components.


Automated finding by repo-monitor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions