Careful Company: HTTP Upload Egress
careful_company_running_windows.upload
Blocks HTTP file-upload primitives (`-InFile`, `-Form`, `curl -T`, `-F field=@file`, `--data-binary @file`, `--post-file`, `WebClient.UploadFile`, `GetRequestStream`, `MultipartFormDataContent`, BITS uploads), file-drop and paste services, `gh gist create`, `certreq -Post`, and request bodies built from file or clipboard contents. Mutating requests with an inline body warn instead of blocking; plain GETs and downloads are untouched.
- 18blocking rules
- 3safe patterns
- 12High
- 6Medium
[packs]
enabled = ["careful_company_running_windows.upload"]Evaluated when a command contains Invoke-WebRequest, invoke-webrequest, INVOKE-WEBREQUEST, Invoke-RestMethod, invoke-restmethod, INVOKE-RESTMETHOD, iwr, IWR, irm, IRM.
Blocking rules
Each rule ID is careful_company_running_windows.upload:<name>. Use it in allowlists and [policy.rules].
Highbits-uploadA BITS transfer in the Upload direction sends a local file to a server.
Explanation
`Start-BitsTransfer -TransferType Upload` and `bitsadmin /transfer job /upload` push a local file to a URL using the background transfer service, which survives logoff and retries on its own. The default direction is Download and is not matched here. Safer alternatives: - Omit `-TransferType Upload` when the intent is to fetch something - Use an internal destination for transfers that must happen
Highcertreq-post-uploadcertreq -Post uploads a local file's contents to an arbitrary URL.
Explanation
`certreq -Post -config https://host/ C:\data.txt out.txt` posts the file to any URL. It is a signed, built-in Windows binary, so it draws no attention on its own — and it has nothing to do with certificates when used this way. Safer alternatives: - Use certreq only against your own certificate authority - Move files through an approved, logged channel
Highcurl-data-from-filecurl -d @file sends the contents of a local file as the request body.
Explanation
The `@` prefix on curl's data flags means "read this from a file": `--data-binary @C:\dump.sql` sends the whole file. `-d @-` reads standard input. (`--data-raw` deliberately does not interpret `@` and is not matched.) Safer alternatives: - Pass an inline literal body when the request only needs parameters - Send to an internal endpoint
Highcurl-form-file-attachcurl -F field=@file attaches a local file to a multipart upload.
Explanation
In a curl form field, `@` reads the file as an attachment and `<` reads it as the field's value — `-F "note=<C:\secrets.txt"` is as much an upload as `-F "file=@C:\secrets.txt"`, and is much easier to overlook. Safer alternatives: - Pass literal values (`-F name=value`) when no file needs to be sent - Send to an internal endpoint
Highcurl-upload-filecurl -T / --upload-file uploads a local file.
Explanation
`curl -T C:\data.zip https://host/path` PUTs the file to the server; `-T -` sends standard input instead, which is how a pipeline's output leaves the machine. It also works over `ftp://`, `sftp://`, and `smb://`. Safer alternatives: - `curl -o file URL` (the download direction) is not matched - Upload to an internal endpoint if the transfer is required
Highdotnet-request-stream-uploadGetRequestStream / a populated MultipartFormDataContent write a request body from a stream.
Explanation
`HttpWebRequest.GetRequestStream()` has no read-only use at all — obtaining the stream is how bytes get written to a request. `MultipartFormDataContent` is matched only once something is added to it (`.Add(`, a `StreamContent`, a `ByteArrayContent`), since an empty one carries nothing. Together they are the standard way to upload from a PowerShell one-liner without touching a cmdlet parameter. Safer alternatives: - Use `GetResponseStream`/`DownloadString` when the intent is to read - Route the send through an approved internal service
Highdotnet-webclient-uploadWebClient.Upload*/OpenWrite sends local data to a URL.
Explanation
`(New-Object Net.WebClient).UploadFile($url,'C:\data.zip')` — and the `UploadData`, `UploadString`, `UploadValues`, and `OpenWrite` variants — are the .NET upload primitives. They bypass every `Invoke-*` parameter rule because no cmdlet is involved. Safer alternatives: - `DownloadFile`/`DownloadString` (the read direction) are not matched by this rule - Hand the data to an approved internal service instead
Highgh-gist-creategh gist create publishes file contents to GitHub.
Explanation
`gh gist create secrets.env` uploads the file to the authenticated GitHub account. `--public` makes it world-readable and indexable, but even a secret gist is a URL that anyone holding it can read, hosted outside company control. Safer alternatives: - Share the file through the repository or an internal store - `gh gist list` / `gh gist view` (reading) are not matched
Highps-http-body-from-fileA request body built from file or clipboard contents sends that content over HTTP.
Explanation
`-Body (Get-Content C:\data.csv -Raw)` and `[IO.File]::ReadAllBytes(...)` send a file's contents without ever naming `-InFile`. `[Convert]::ToBase64String` in the same position is the same thing with an encoding step, and `-Body (Get-Clipboard)` sends whatever the user last copied — frequently a password or a token. Safer alternatives: - Send a summary or a record count rather than the content itself - Target an internal endpoint if the data must be transmitted
Highps-http-upload-fileInvoke-WebRequest/-RestMethod with -InFile, or -Form carrying a file, uploads it.
Explanation
`-InFile` streams a local file as the request body and has no read-only use, so it is an upload regardless of URL or method. `-Form` builds a multipart request, which is an upload only when a file goes into it — a form of literal fields is just a POST body, so this rule requires visible file evidence (`Get-Item`, a drive-qualified path, a file stream) and leaves the literal-only case to the warn-level rule. Safer alternatives: - Leave the file on disk and report its path to the operator - Send to an internal endpoint (loopback/RFC1918/*.internal are allowed)
Highps-splatted-uploadA splatted parameter hashtable containing InFile, then splatted into a web request, uploads a file.
Explanation
PowerShell splatting (`$p = @{Uri='…'; InFile='C:\data.zip'}; irm @p`) moves every parameter off the command line, so flag-based rules see nothing. This requires **both** a hashtable with an `InFile` key **and** a subsequent splat into a web request. A hashtable that is merely assigned and never used does not match. The rule is deliberately conservative about proving that the two variable names are identical: keeping the file-bearing assignment and the executed request on separate lines avoids this warning when they are unrelated. Safer alternatives: - Pass parameters explicitly so the operation is visible in the transcript - Drop the InFile entry if the request does not need to carry a file
Highwget-post-filewget --post-file / --body-file uploads a local file.
Explanation
`wget --post-file=C:\data.zip https://host` sends the named file as the request body, as does `--body-file` with `--method=PUT`. Safer alternatives: - `wget -O out URL` (the download direction) is not matched - Send to an internal endpoint
Mediumcli-http-mutating-requestA curl/wget POST/PUT/PATCH sends a body to a server that is not internal.
Explanation
Same reasoning as the PowerShell rule: an inline `-d` body is usually an API call, so this warns rather than blocks. Bodies read from a file (`-d @file`) are a separate, blocking rule because those are unambiguous. Safer alternatives: - Confirm the destination host before sending a body to it - Set a `[policy.rules]` entry to "deny" to make this a hard block
Mediumcurl-config-filecurl -K reads its arguments from a file, hiding the request from inspection.
Explanation
`curl -K C:\opts.txt https://host` takes every flag — including upload flags and the real URL — from a file, so nothing about the request is visible on the command line. That is not automatically malicious, but it means this command cannot be reviewed as written. Safer alternatives: - Pass the flags explicitly so the request is auditable - Print the config file first if it must be used
Mediumdotnet-http-mutating-requestHttpClient.PostAsync/PutAsync/PatchAsync sends a request body.
Explanation
`HttpClient.PostAsync($url, $content)` carries a body outward, but the content is as often a JSON query as it is a file — the same ambiguity as an inline `-Body`, so it warns rather than blocks. When the content is built from `MultipartFormDataContent` or a `StreamContent`, the blocking rule above applies instead. Safer alternatives: - Confirm the destination host before sending a body to it - Use `GetAsync` when the intent is to read
Mediumfile-drop-serviceFile-drop and paste services publish whatever is sent to a link anyone can fetch.
Explanation
These hosts exist to accept an anonymous upload and hand back a URL that is readable by anyone who obtains it, usually with no expiry and no audit trail. Touching one is warned rather than blocked, because fetching *from* a paste link is an inbound read and this preset is about what leaves. Actually sending to one — `curl -T`, `-F file=@…`, `--data-binary @…` — is caught as an upload by the blocking rules above. Safer alternatives: - Use an internal file share or artifact store - Attach the file to the ticket or PR that needs it
Mediumgh-content-uploadgh release upload / secret set / repo create --push publishes local content to GitHub.
Explanation
These are ordinary release and CI operations, and also the way a whole working tree or a secret reaches a remote account in one command. Warned rather than blocked because the legitimate uses are common. Safer alternatives: - Confirm the target repository belongs to the organization - Set a `[policy.rules]` entry to "deny" if releases should never come from an agent
Mediumps-http-mutating-requestA PowerShell POST/PUT/PATCH sends a body to a server that is not internal.
Explanation
A mutating request carries data outward, but an inline body is a GraphQL query or an Elasticsearch search about as often as it is an exfiltration — and the two look identical. This warns and is recorded rather than blocking, so ordinary API work keeps running. Safer alternatives: - Confirm the destination host before sending a body to it - Set a `[policy.rules]` entry to "deny" to make this a hard block
Safe patterns
Checked first. A command that matches one is never blocked by this pack.
read-only-data-contextdcg-self-inspectioninternal-http-target