A 403 that still deleted someone else's private shares
The first thing I noticed was the 403. It was the right answer to the wrong question, and by the time the server produced it, the damage was already done. It was late October 2026 and I was reading sharing.service.ts in
The first thing I noticed was the 403. It was the right answer to the wrong question, and by the time the server produced it, the damage was already done.
It was late October 2026 and I was reading sharing.service.ts in a local checkout of internxt/drive-server-wip, the NestJS backend behind Internxt Drive. I had decided to audit the sharing module first because it is where the interesting state lives: private shares between users, pending invitations, public links, encryption keys, and the mapping between a file UUID and the people allowed to see it. A cloud storage product can survive a lot of bugs. It cannot survive getting that mapping wrong.
The specific question I was asking was boring: in each method that mutates sharing state, where does the authorization check happen relative to the write? Not whether a check exists, since most methods have one, but where it sits in the sequence. A check after a write is a check that never ran when it mattered. I had a local checkout of commit 7d7a8be2 from 28 October, a disposable PostgreSQL on port 55432 with TLS and migrations applied, and a Valkey instance on 56379. Synthetic users, synthetic keys, no production system, no real account. That boundary was not an afterthought; it was the condition under which I was willing to run anything at all.
createPublicSharing is supposed to create a public link for a file or folder. You send an item UUID, an encryption key, an encrypted code, and optionally a flag called persistPreviousSharing. If that flag is absent or false, the method cleans up other sharings for the same item first. That makes sense on the surface: you do not want a folder to be public and privately shared at the same time. Here is the middle of the method, as it stood on the audited commit:
updatedAt: new Date(),
});
const shouldRemoveOtherSharings = !dto.persistPreviousSharing;
if (shouldRemoveOtherSharings) {
await this.removeItemFromBeingShared(
dto.itemType,
dto.itemId,
SharingType.Private,
);
}
const sharing = await this.sharingRepository.findOneSharingBy({
itemId: dto.itemId,
itemType: dto.itemType,
type: SharingType.Public,
});
There are three things in that block, and their order is the whole finding. First, removeItemFromBeingShared runs. Then findOneSharingBy looks for an existing public sharing. Only then does item.isOwnedBy(user) decide whether the caller is allowed to touch the item at all. The ForbiddenException at line 1281 returns 403 to a non-owner, which is correct as far as the HTTP response goes. It is also too late, because the deletes have already been issued.
I went to the helper next, expecting to find an owner filter I had missed:
private async removeItemFromBeingShared(
itemType: Sharing['itemType'],
itemId: Sharing['itemId'],
type: Sharing['type'],
sharedWithType: SharedWithType = SharedWithType.Individual,
) {
if (type === SharingType.Private) {
await this.sharingRepository.deleteInvitesBy({
itemId,
itemType,
});
}
await this.sharingRepository.deleteSharingsBy({
It calls deleteInvitesBy for the private case and then deleteSharingsBy, with no ownerId, no userId and no predicate tying the rows to the authenticated caller anywhere in the signature. The repository methods are equally direct:
async deleteInvitesBy(where: Partial<SharingInvite>): Promise<void> {
await this.sharingInvites.destroy({
where,
});
}
async bulkDeleteInvites(
itemIds: SharingInvite['itemId'][],
Nothing in this path opens a transaction, so there is no rollback to undo the deletes when the ForbiddenException fires a few lines later. In a NestJS service, an exception unwinds the call stack; it does not unwind a committed database write.
There is a design question hiding behind the ordering bug, and the eventual fix answered it in a way I found interesting. Why should creating a public link destroy the item's private shares at all? The clean-up exists so an item is not public and privately shared at once, a product rule rather than a security requirement, and it was implemented as an unconditional sweep before anyone checked who was asking. The fix does not add a transaction or move the check earlier. It removes the sweep from this path entirely and lets invite creation manage its own state. That is the stronger position: when a mutation cannot be justified for every caller who can reach it, restricting the caller is a patch, removing the mutation is a design decision. The advisory is rated Low because the impact was revocation rather than disclosure, but the underlying pattern of product behaviour implemented before authorization is the same pattern that produces much worse bugs in other codebases.
The next question was whether an unauthenticated stranger could even reach the method. They cannot, because the route is guarded, but the guard is narrower than it looks. The controller method sits behind the standard auth and in-behalf guards, and the in-behalf guard permits requests that carry no workspace header at all, which is the normal case for a personal drive item. On the audited commit, WorkspacesResourcesItemsInBehalfGuard.canActivate reads the x-internxt-workspace header, finds it absent, and falls through to the permissive branch rather than rejecting the request. So the prerequisite is only: be logged in, and know a folder UUID. UUIDs are not secrets in most systems; they appear in links, logs, client state and shared metadata. The attacker does not need to be the owner, a workspace member, or an invitee.
At that point I stopped reading and wrote a test. I wanted a single self-contained file that a maintainer could run without believing a word of my prose. Three synthetic users: an owner, an attacker, and a recipient. A folder under the owner's root. One private Sharing row to the recipient, one SharingInvite row with a READER role. Then one HTTP request from the attacker, with persistPreviousSharing: false:
it('C07: nonowner gets 403 after victim private share and invite are deleted', async () => {
const owner = await createTestUser(app);
const attacker = await createTestUser(app);
const recipient = await createTestUser(app);
const folder = await childFolder(owner, 'victim-shared-folder');
await sharings.create({
itemId: folder.uuid, itemType: 'folder', ownerId: owner.user.uuid,
sharedWith: recipient.user.uuid, type: 'private',
encryptionKey: 'local-key', encryptionAlgorithm: 'aes',
} as any);
const role = await roles.create({ id: v4(), name: 'READER' } as any);
await invites.create({
itemId: folder.uuid, itemType: 'folder', sharedWith: recipient.user.uuid,
encryptionKey: 'local-key', encryptionAlgorithm: 'aes', type: 'private', roleId: role.id,
} as any);
const res = await request(app.getHttpServer())
.post('/sharings/')
.set('Authorization', `Bearer ${attacker.token}`)
The response was 403. Then the test counted the rows:
expect(res.status).toBe(403);
expect(await sharings.count({ where: { itemId: folder.uuid, type: 'private' } })).toBe(0);
expect(await invites.count({ where: { itemId: folder.uuid } })).toBe(0);
Zero private shares. Zero invites. The owner's links were gone, silently, and the only evidence was a failed request in the attacker's log. No file content was read, no key was returned to the attacker, nothing was exfiltrated. That is why the eventual advisory was rated Low. It is also why the bug bothered me: a destructive action that anyone can trigger against someone else's data, hidden behind an HTTP status that says nothing happened.
Getting the test to run took one small detour. On that commit the repository's mock Bridge provider has no getLimit() method, but the application calls it while the test app is being constructed, so the PoC ships with a four-line test-only patch that adds it. I documented the patch separately from the finding and wrote into the report that it changes test code only and does not remediate anything; a reviewer should never have to wonder whether a PoC quietly fixed the bug it claims to demonstrate. The runner that staged the file, pointed every connection string at loopback, forced SendGrid into sandbox mode and removed the staged file again on exit is written up in the harness post; the PoC file itself repeats the same boundary check at the top of its beforeAll, throwing unless RDS_HOSTNAME is 127.0.0.1.
The first run took about forty seconds, most of it bootstrapping the Nest application against the disposable database. Jest reported one suite, one test, one pass, and the log between those two lines is the entire finding: an HTTP request from a user who owns nothing, a 403, and two SQL counts that came back as zero. I ran it twice more because a result like that deserves a second look: deleted rows do not come back, so the second run had to build its own fixtures from scratch, and it did. Reproducibility was the point. A maintainer reading the report could not verify my conclusion about their production system, but they could verify everything I had actually claimed: that this code, on this commit, with this request, deletes these rows.
On 28 October I put thirteen of these packages into an archive (a PoC, a test log, source references pinned to the audited commit, and a hash of the whole thing) and sent it to [email protected] and [email protected], the address in the repository's own SECURITY.md.
Getting the package to them had taken eight days: an auto-reply from hello@ on 20 October, a public issue on 24 October that asked only for a confidential channel, another auto-reply on 26 October, and then the suggestion on 28 October that I leave a comment on the public GitHub page so the developers would check, at a company whose product is sold on end-to-end encryption and zero-knowledge storage. I declined and said I would escalate to a national CERT; private vulnerability reporting was switched on within the hour, and the package went out that afternoon. The next morning support wrote "I will pass this to the necessary team members", the last substantive answer for three weeks. The full sequence of dates, quotes and emails is in the timeline post.
The fix landed on 29 October, one day after the report, in d1f51c9:
@@ -1163,16 +1163,6 @@ export class SharingService {
throw new BadRequestException('Limit for sharing an item reach');
}
- const shouldRemoveOtherSharings = !createInviteDto.persistPreviousSharing;
-
- if (shouldRemoveOtherSharings) {
- await this.removeItemFromBeingShared(
- createInviteDto.itemType,
- createInviteDto.itemId,
Internxt removed the delete from both public-share and invite creation, deleted the helper entirely, and added an HTTP regression test. That last part is the part I respect most. The existing unit test for this path checked only that a non-owner gets 403, which passed both before and after the fix. The new e2e test posts to /sharings as a non-owner, expects the 403, and exists precisely because the old test could not see the side effects:
it('When the owner creates it, then it returns the public sharing', async () => {
.post('/sharings')
.set('Authorization', `Bearer ${owner.token}`)
.send(buildDto(folder.uuid))
.expect(HttpStatus.CREATED);
expect(response.body).toMatchObject({
it('When a user who is not the owner tries to create it, then it fails', async () => {
.post('/sharings')
.set('Authorization', `Bearer ${otherUser.token}`)
.send(buildDto(folder.uuid))
.expect(HttpStatus.FORBIDDEN);
it('When the item does not exist, then it fails', async () => {
.post('/sharings')
.set('Authorization', `Bearer ${owner.token}`)
.send(buildDto(v4()))
.expect(HttpStatus.NOT_FOUND);
A fix in a day, with a regression test, is good engineering. What followed was not.
On 9 November a maintainer published GHSA-8734-26fx-fg92 as Low, CVSS 2.3, vector CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N. I was not told. The vector is defensible: integrity impact Low, no confidentiality impact, attack complexity High because the attacker needs the UUID. I had written the same boundary into the report myself: no production system was tested, the attacker knew the item UUID, and deployment-specific reachability needed maintainer review. The rating was not the problem.
The problem was that between 29 October and 20 November nobody answered a single question. On 4 November I asked in the issue whether they needed help and offered to open pull requests. On 19 November I asked why nobody was answering. Meanwhile the repository received commits almost every working day: index cleanups, performance work, new features, a client-version policy, a photos bucket. The team was visibly busy. Just not with this queue.
I had taken the case to CERT-Bund, Germany's national CERT at the BSI, in early November. Their view on 11 November was reasonable: since some issues had already been fixed, there was no reason to assume the rest would not be. They asked me to report back on 24 November. On 20 November I emailed a disclosure schedule to security@ and hello@: 1 December for the timeline and full details of the fixed issues, 18 January 2027 for everything else, ninety days after my first email.
On that same 20 November, the issue was closed and locked to collaborators, C08 was published as High, C03 was fixed and published as Moderate, C09 and C11 were closed without a published fix or a stated reason, and a maintainer acknowledged the report for the first time in three weeks. C07 had been fixed for twenty-two days. From the outside it looked less like triage than like a queue someone had finally opened.
The technical lesson here is old and short: authorize first, change data second, and test that a 403 has no side effects. A guard that returns the right status code can still be the wrong guard. The other lesson is about what a severity rating does and does not measure. "Low" describes the impact of this bug on a deployed system. It says nothing about the cost of a report sitting unread for a month, or about how many other people can read the same open-source code and reach the same line 1268 without ever sending an email.
The disclosure schedule still stands: 1 December 2026 for the timeline and the fixed issues, 18 January 2027 for full technical details of the remaining findings. I have no evidence any of this was exploited. The advisories are open, the PoCs are attached, and the offer to verify fixes still stands.
References: GHSA-8734-26fx-fg92, d1f51c9, PR #1257, issue #1246.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.