Repository navigation
fix: custom-tool injection, SOCKS5 open proxy, multipart body cap, example IP - #575
Merged
Merged
Conversation
Username/password was offered to any client and accepted any credentials, so a non-loopback client bypassed the loopback-only rule applied to no-auth by offering method 0x02. Credentials are never verified, so both methods are now accepted from loopback clients only; any other client gets 0xFF.
renderTemplate replaced placeholders param by param, so a value containing
another placeholder was expanded again inside the first value's shell
quotes: a="{b}", b="; id" rendered {a} as ''; id'' and ran id. Whether it
happened depended on map iteration order. Scan the template once and never
rescan substituted values.
limitRequestBody skipped every request with a multipart Content-Type, so any handler decoding JSON straight from r.Body (about 30 of them) read an unbounded body when the client simply labelled the request multipart. Multipart bodies now get an upload-sized cap (the largest limit an upload handler sets); upload handlers keep their own tighter limits and messages.
…example The host filter description showed a real routable IP (107.172.96.177) to the model as its example. Use 192.0.2.10 from TEST-NET-1 (RFC 5737) so the example cannot prime the agent toward a third-party host.
This was referenced Nov 26, 2026
BaaRai
added a commit
to Coff0xc/ARTEX-contrib
that referenced
this pull request
Nov 26, 2026
BaaRai
force-pushed
the
fix/main-security-hardening
branch
from
November 26, 2026 22:24
19490e5 to
f3daf0c
Compare
BaaRai
added a commit
to Coff0xc/ARTEX-contrib
that referenced
this pull request
Nov 26, 2026
Owner
|
Merged, thanks @5P34R. Rebased on current main and verified with its tests and negative control. |
BaaRai
force-pushed
the
fix/main-security-hardening
branch
from
November 26, 2026 22:39
f3daf0c to
d3b351e
Compare
BaaRai
force-pushed
the
fix/main-security-hardening
branch
from
November 26, 2026 22:40
d3b351e to
c5c3ecf
Compare
Owner
|
Merged, thanks @5P34R. Rebased on current main and verified with its tests and negative control. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four security fixes for issues found on
mainduring a review of the open PRs and a backdoor audit of the codebase. Each fix is a separate commit with its own test.Problems and fixes
1. Custom-tool parameters could inject shell commands through each other (
server/customtool.go)renderTemplatereplaced placeholders one parameter at a time. A value that contains another placeholder was therefore expanded a second time, inside the first value's shell quotes. Example: witha="{b}"andb="; id",cmd {a} {b}rendered ascmd ''; id'' '; id', which runsid. Whether it happened depended on map iteration order. Any caller that controls two parameters can trigger it, including a prompt-injected agent.Fix: render the template in a single left-to-right pass that never rescans a substituted value. A
{that does not start a known placeholder is copied as is, so{{a}}, unclosed braces and unknown names render the same as before.2. The SOCKS5 listener was an open proxy to any non-loopback client (
traffic/socks5.go)No-auth (
0x00) was accepted from loopback clients only. Username/password (0x02) was offered to every client and accepted any credentials, so a remote client got past the loopback rule just by offering0x02. The listener is off by default and binds127.0.0.1:1080, so this mattered only whenARTEX_SOCKS5_ADDRwas set to a reachable address.Fix: credentials are still not verified, because the username only carries the pace marker. Both methods are now accepted from loopback clients only, and any other client gets
0xFF(no acceptable methods). Loopback behaviour is unchanged, including theartex-pacemarker.docs/traffic-socks5.mdanddocs/traffic-socks5-udp.mdare updated.Behaviour change: a non-loopback bind now accepts no remote clients. The docs already told operators to keep the listener on loopback.
3. Requests labelled multipart had no body cap (
server/server_mgmt.go)limitRequestBodyskipped every request with a multipartContent-Type. About 30 handlers decode JSON straight fromr.Body, and each of them read an unbounded body when the client simply labelled the request multipart.Fix: multipart bodies now get an outer cap of
maxMultipartBodyBytes, the largest limit any upload handler sets (chat attachments, 513 MiB). No real upload is refused, and a test checks that the constant still covers every upload handler. The body is wrapped with a plainMaxBytesReader, notlimitedBody, sodecode()still applies its 32 MiB JSON cap. Upload handlers keep their own tighter limits and error messages.4. A real IP in a tool description shown to the model (
traffic/traffic.go)The
traffic_searchhost-filter example used107.172.96.177, a routable third-party address. It now uses192.0.2.10from TEST-NET-1 (RFC 5737), so the example cannot prime the agent toward that host.Tests
TestRenderTemplateDoesNotExpandSubstitutedValuesrenders the same template 200 times so the map-order bug shows up reliably; it fails onmain.TestRenderTemplateLiteralBracespins the literal-brace behaviour.TestSOCKS5NonLoopbackClientRefusedForEveryMethodfails onmainfor both offers that include0x02.TestSOCKS5LoopbackClientStillAcceptedcovers IPv4 and IPv6 loopback, with and without the pace marker.TestMultipartLabelDoesNotUncapTheBodyandTestMultipartCapCoversEveryUploadHandlercover the new cap.go build ./...,go vet ./server/ ./traffic/andgo test -p 1 ./server/ ./traffic/all pass.CHANGELOG entries are added under
[Unreleased] / Fixed.🤖 Generated with Claude Code