Algorithm Search⌘K

Algorithmresearch

SybilRank

Also called early-terminated trust propagation.

Ranks accounts by a short power iteration of trust from known honest seeds, which stays mostly inside the honest region.

Time
O((n + m) log n) worst · average · best
Space
O(n) extra
Where
m = the number of friendship edges; n = the number of accounts; w = the number of iterations
Properties
deterministicparallelranking not classification
Origin
Qiang Cao, Michael Sirivianos, Xiaowei Yang, Tiago Pregueiro, 2012

SybilRank ranks the accounts of a social network by how likely they are to be fake. It puts trust on a few accounts known to be honest, the seeds, and spreads it along friendships by power iteration for only about log⁡n\log n steps. Because fake accounts, the Sybil identities, have few friendships with honest users, little trust reaches them in so few steps, and ranking accounts by trust divided by degree puts most of them at the bottom. Cao, Sirivianos, Yang and Pregueiro designed it for the operators of large networks, who then check the lowest-ranked accounts.

In plain words

Pour water on a few people you trust in a crowd. Each round, everyone passes their water equally to their friends. Real people have many friends among each other, so the water spreads quickly through them. Fake accounts are friends mostly with other fake accounts and have only a few links to real people, so the water reaches them slowly.

Stop pouring after a few rounds, before the water has spread evenly everywhere. Then measure how much water each person holds per friend. The people with the least are most likely fake. If you wait too long, the water evens out across the whole crowd and the test no longer tells anything.

The problem

Input. An undirected social graph G=(V,E)G = (V, E) with nn nodes and mm edges, every node of degree at least 1; a nonempty set of trust seeds SS known to be honest; a total trust TG>0T_G > 0; and a number of iterations ww.

Model (Cao et al., Section 3). The nodes split into honest nodes HH and Sybil nodes. The honest region, the subgraph on HH, is connected, not bipartite, and fast mixing: a random walk in it reaches its stationary distribution in O(log⁡n)O(\log n) steps. The attacker can create any number of Sybil nodes and any edges among them, but only gg attack edges between Sybil and honest nodes, attached to random honest nodes.

Output. A ranking of VV from most suspect to least suspect.

The algorithm

  1. SYBILRANK(G, S, T_G, w)
  2. 1for each node v: T(v) ← T_G / |S| if v is in S, else 0
  3. 2repeat w times
  4. 3T'(v) ← 0 for each node v
  5. 4for each node u and each neighbor v of u: T'(v) ← T'(v) + T(u) / deg(u)
  6. 5T ← T'
  7. 6for each node v: R(v) ← T(v) / deg(v)
  8. 7return the nodes sorted by R, lowest first (ties by name)

Line L4 is one step of the random walk on GG, applied to the vector of trust: every node splits its trust evenly among its neighbors. The total TGT_G stays the same. Cao et al. use w=O(log⁡n)w = O(\log n); the code uses w=⌈log⁡2n⌉w = \lceil \log_2 n \rceil. Line L6 divides by the degree because, after many steps, trust is proportional to degree, so trust per degree is the quantity that is equal everywhere at the stationary state and lower on nodes that the walk has not reached yet.

Example

The graph of Figure 4 of Cao et al. has honest nodes AA to EE and Sybil nodes FF to II, with edges AA-BB, AA-CC, BB-CC, BB-EE, CC-DD, DD-EE, EE-FF, FF-GG, FF-HH, GG-HH, GG-II and HH-II. The only attack edge is EE-FF. The seeds are CC and DD, with TG=648T_G = 648.

iteration AA BB CC DD EE FF GG HH II
0 0 0 324 324 0 0 0 0 0
1 108 108 162 108 162 0 0 0 0
2 90 162 144 108 90 54 0 0 0
3 102 123 153 78 126 30 18 18 0
4 92 144 131 93 90 54 16 16 12
degree 2 3 3 2 3 3 3 3 2
T/deg⁡T / \deg after 4 46 48 43.67 46.5 30 18 5.33 5.33 6

The ranking, lowest first, is G,H,I,F,E,C,A,D,BG, H, I, F, E, C, A, D, B: all four Sybils come before all five honest nodes. With 50 iterations instead of 4, the trust per degree is between 26.79 and 27.19 for every node, close to the stationary value 648/24=27648 / 24 = 27, and the ranking says almost nothing.

Correctness

Theorem (what is computed). After line L5 has run ii times, T(v)=TG⋅Pr⁡[Xi=v]T(v) = T_G \cdot \Pr[X_i = v], where X0X_0 is a uniform random seed and X0,X1,…X_0, X_1, \ldots is the simple random walk on GG. The total trust is TGT_G at every step. If GG is connected and not bipartite, T(v)→TGdeg⁡(v)/(2m)T(v) \to T_G \deg(v) / (2m) as i→∞i \to \infty, so R(v)→TG/(2m)R(v) \to T_G / (2m) for every vv.

Lemma (escape bound). For any ww, the total trust on Sybil nodes after ww iterations is at most the sum, over i=0,…,w−1i = 0, \ldots, w - 1, of ∑T(i)(u)/deg⁡(u)\sum T^{(i)}(u) / \deg(u) over the attack edges (u,s)(u, s) with uu honest. This holds for every placement of Sybil nodes and edges, since trust enters the Sybil region only along attack edges. If, in addition, every honest node holds at most τ\tau trust per degree at each step, the Sybil region holds at most wgτw g \tau trust after ww steps.

The proofs are in proofs/correctness.md.

Guarantee and its adversary (Cao et al., security analysis; theorem, not proved here). Under the model above, with the attacker placing gg attack edges at random honest nodes and w=O(log⁡n)w = O(\log n), the number of Sybil nodes ranked above (as less suspect than) honest nodes is O(glog⁡n)O(g \log n), however many Sybils the attacker creates. Against an attacker who places attack edges close to the seeds, the bound does not apply; Cao et al. study that case by experiment and recommend spreading many seeds.

Proof: Correctness of SybilRankfull

Let G=(V,E)G = (V, E) be an undirected graph with nn nodes and mm edges, every node of degree at least 1. Let SS be a nonempty set of seeds and TG>0T_G > 0. Write T(i)T^{(i)} for the vector TT after line L5 of the algorithm has run ii times, and T(0)T^{(0)} for the vector set by line L1. Let PP be the transition matrix of the simple random walk on GG: P(u,v)=1/deg⁡(u)P(u, v) = 1 / \deg(u) if {u,v}∈E\{u, v\} \in E, and 00 otherwise.

Lemma 1 (one step). For i≥1i \ge 1 and every node vv,

T(i)(v)=∑u:{u,v}∈ET(i−1)(u)deg⁡(u)=∑u∈VT(i−1)(u)P(u,v).T^{(i)}(v) = \sum_{u : \{u, v\} \in E} \frac{T^{(i-1)}(u)}{\deg(u)} = \sum_{u \in V} T^{(i-1)}(u) P(u, v) .

Proof. Line L3 sets T′(v)=0T'(v) = 0. Line L4 visits each node uu once and, for each neighbor vv of uu, adds T(i−1)(u)/deg⁡(u)T^{(i-1)}(u) / \deg(u) to T′(v)T'(v). So T′(v)T'(v) receives exactly one term for each neighbor uu of vv. Line L5 sets T(i)=T′T^{(i)} = T'. The second form follows from the definition of PP. □\square

Lemma 2 (conservation). ∑vT(i)(v)=TG\sum_v T^{(i)}(v) = T_G for every i≥0i \ge 0.

Proof. For i=0i = 0, line L1 puts TG/∣S∣T_G / |S| on each of the ∣S∣|S| seeds. For i≥1i \ge 1, by Lemma 1,

∑vT(i)(v)=∑uT(i−1)(u)∑vP(u,v)=∑uT(i−1)(u),\sum_v T^{(i)}(v) = \sum_u T^{(i-1)}(u) \sum_v P(u, v) = \sum_u T^{(i-1)}(u) ,

since each row of PP sums to 1, because uu has deg⁡(u)≥1\deg(u) \ge 1 neighbors and gives 1/deg⁡(u)1 / \deg(u) to each. Induction on ii completes the proof. □\square

Theorem 1 (what is computed). Let X0X_0 be uniform on SS and let X0,X1,…X_0, X_1, \ldots be the simple random walk on GG. Then T(i)(v)=TGPr⁡[Xi=v]T^{(i)}(v) = T_G \Pr[X_i = v] for every i≥0i \ge 0 and every vv.

Proof. By induction on ii. For i=0i = 0, Pr⁡[X0=v]=1/∣S∣\Pr[X_0 = v] = 1 / |S| for v∈Sv \in S and 00 otherwise, which matches line L1 after multiplication by TGT_G. For i≥1i \ge 1, by the Markov property, Pr⁡[Xi=v]=∑uPr⁡[Xi−1=u]P(u,v)\Pr[X_i = v] = \sum_u \Pr[X_{i-1} = u] P(u, v). By the induction hypothesis and Lemma 1, T(i)(v)=∑uTGPr⁡[Xi−1=u]P(u,v)=TGPr⁡[Xi=v]T^{(i)}(v) = \sum_u T_G \Pr[X_{i-1} = u] P(u, v) = T_G \Pr[X_i = v]. □\square

Corollary (limit, cited fact). If GG is connected and not bipartite, the walk is irreducible and aperiodic, and its unique stationary distribution is π(v)=deg⁡(v)/(2m)\pi(v) = \deg(v) / (2m), since ∑uπ(u)P(u,v)=∑u∼vdeg⁡(u)2m⋅1deg⁡(u)=deg⁡(v)2m\sum_u \pi(u) P(u, v) = \sum_{u \sim v} \frac{\deg(u)}{2m} \cdot \frac{1}{\deg(u)} = \frac{\deg(v)}{2m}. By the convergence theorem for finite irreducible aperiodic Markov chains, Pr⁡[Xi=v]→π(v)\Pr[X_i = v] \to \pi(v) for every start. So T(i)(v)→TGdeg⁡(v)/(2m)T^{(i)}(v) \to T_G \deg(v) / (2m), and the score R(v)=T(v)/deg⁡(v)R(v) = T(v) / \deg(v) of line L6 tends to TG/(2m)T_G / (2m) for every vv. Only the convergence theorem is cited; the stationarity check is the computation above.

Lemma 3 (escape bound). Let H⊆VH \subseteq V be the honest nodes, Y=V∖HY = V \setminus H the Sybil nodes, and AA the set of attack edges {u,s}\{u, s\} with u∈Hu \in H and s∈Ys \in Y. If S⊆HS \subseteq H, then for every w≥0w \ge 0,

∑s∈YT(w)(s)≤∑i=0w−1∑{u,s}∈AT(i)(u)deg⁡(u).\sum_{s \in Y} T^{(w)}(s) \le \sum_{i=0}^{w-1} \sum_{\{u, s\} \in A} \frac{T^{(i)}(u)}{\deg(u)} .

The bound holds for every graph on YY and every choice of AA, so it holds against an attacker who controls all Sybil nodes and their edges.

Proof. Let σi=∑s∈YT(i)(s)\sigma_i = \sum_{s \in Y} T^{(i)}(s). Since S⊆HS \subseteq H, σ0=0\sigma_0 = 0. Fix i≥1i \ge 1. By Lemma 1, each node xx sends T(i−1)(x)/deg⁡(x)T^{(i-1)}(x) / \deg(x) along each of its deg⁡(x)\deg(x) edge ends, and T(i)(v)T^{(i)}(v) is the sum of what arrives at vv. Split the trust that arrives in YY by the sender. A Sybil sender x∈Yx \in Y sends at most T(i−1)(x)T^{(i-1)}(x) in total, so all Sybil senders together deliver at most σi−1\sigma_{i-1} to YY. An honest sender u∈Hu \in H delivers to YY only along its attack edges, T(i−1)(u)/deg⁡(u)T^{(i-1)}(u) / \deg(u) on each. Hence

σi≤σi−1+∑{u,s}∈AT(i−1)(u)deg⁡(u).\sigma_i \le \sigma_{i-1} + \sum_{\{u, s\} \in A} \frac{T^{(i-1)}(u)}{\deg(u)} .

Summing this inequality from i=1i = 1 to ww and using σ0=0\sigma_0 = 0 gives the claim. □\square

Corollary (per-step cap). If T(i)(u)/deg⁡(u)≤τT^{(i)}(u) / \deg(u) \le \tau for every honest node uu that has an attack edge and every i<wi < w, then ∑s∈YT(w)(s)≤w∣A∣τ=wgτ\sum_{s \in Y} T^{(w)}(s) \le w |A| \tau = w g \tau. This is the form used by Cao et al.: in a fast-mixing honest region, T(i)(u)/deg⁡(u)T^{(i)}(u) / \deg(u) is close to TG/(2m)T_G / (2m) after a few steps, so the Sybil region gains about gTG/(2m)g T_G / (2m) per step and O(gTGlog⁡n/m)O(g T_G \log n / m) after w=O(log⁡n)w = O(\log n) steps, however many Sybil nodes there are. The step from "close to" to a bound on the ranking is the security analysis of Cao et al. and is not proved here.

Theorem 2 (the output). Line L7 returns the nodes of VV, each exactly once, in nondecreasing order of R(v)=T(w)(v)/deg⁡(v)R(v) = T^{(w)}(v) / \deg(v), with ties broken by the string form of the node.

Proof. Line L6 defines R(v)R(v) for every vv; the division is defined because deg⁡(v)≥1\deg(v) \ge 1. Line L7 sorts the list of all nodes by the key (R(v),name(v))(R(v), \text{name}(v)), and a sort returns a permutation of its input in nondecreasing key order. □\square

Cost. Lines L3 and L5 take O(n)O(n) per iteration, and line L4 takes O(deg⁡(u))O(\deg(u)) for each uu, so O(n+m)O(n + m) per iteration in total. Line L1 and line L6 take O(n)O(n), and line L7 takes O(nlog⁡n)O(n \log n) comparisons. With ww iterations the time is O(w(n+m)+nlog⁡n)O(w (n + m) + n \log n), which is O((n+m)log⁡n)O((n + m) \log n) for w=⌈log⁡2n⌉w = \lceil \log_2 n \rceil. Two vectors of nn values are kept, so the extra space is O(n)O(n). ■\blacksquare

Complexity

In the word RAM model, with trust as floating-point words:

  • Time. Each iteration of lines L3 to L5 touches each node and each edge end once: O(n+m)O(n + m). With w=O(log⁡n)w = O(\log n) iterations the total is O((n+m)log⁡n)O((n + m) \log n), and sorting in line L7 adds O(nlog⁡n)O(n \log n).
  • Space. Two vectors of nn values, O(n)O(n) extra.
  • Parallelism. Each iteration is a sparse matrix-vector product, which splits over machines; Cao et al. ran it on a cluster for the graph of Tuenti, with about 11 million users.

Properties

  • A ranking, not a verdict. The output tells operators which accounts to inspect first; no threshold is part of the algorithm.
  • No jumps. Unlike PageRank and TrustRank, the walk never jumps to random nodes or back to the seeds: random jumps would give Sybils trust in each step, and jumps to the seeds would favor Sybils attached near them.
  • Many seeds. Trust is split over many seeds, so a wrong seed puts only a small share of the trust in the Sybil region.
  • Deterministic. The same graph and seeds always give the same ranking.

Variants and improvements

  • Seeds in every community. Honest users in a community with few links to the seeds receive little trust and look like Sybils. Cao et al. (Section 4.2.2) find communities with the Louvain method and seed a few verified accounts in each.
  • Random-route defenses. SybilGuard and SybilLimit accept or reject single nodes with random routes under the same model of attack edges and fast mixing. SybilRank replaces many random walks by one deterministic power iteration, which is cheaper on large graphs.
  • Personalized PageRank and TrustRank. These run personalized PageRank to convergence with jumps back to the seeds; SybilRank stops early and has no jumps.
  • Community detection. Viswanath et al. (SIGCOMM 2010) showed that social Sybil defenses effectively rank nodes by how well connected they are to the trusted node, which links them to community detection.

When to use it

Use SybilRank when an operator holds the whole social graph, can verify a few honest seeds per community, and wants a list of accounts to inspect in order. It fits fake accounts made in bulk that have few real friends. It does not fit when attackers can obtain many real friendships, for example by taking over real accounts, or when the honest graph is made of weakly linked groups without seeds in each.

Pitfalls

  • Running to convergence. If line L2 repeats until the vector stops changing, trust per degree becomes the same everywhere (the 50-iteration case of the example), and Sybils cannot be told apart. Stop after w=O(log⁡n)w = O(\log n) iterations in line L2.
  • Ranking by raw trust. If line L6 sets R(v)←T(v)R(v) \leftarrow T(v), honest nodes of low degree rank as suspect and a Sybil with many edges to other Sybils can rank as trusted. Divide by the degree, as in line L6.
  • Adding jumps. If line L4 also sends a fraction of trust back to the seeds or to random nodes, Sybils near the seeds or anywhere gain trust in every step. Keep line L4 a plain walk step.
  • Seeds in one community. If line L1 seeds only one community, honest communities far from it end up at the bottom of the ranking. Spread the seeds over the communities.
  • Nodes without friends. A node of degree 0 makes line L4 and line L6 divide by zero. Remove such nodes first, or treat them separately.

Implementations

The code runs on small synthetic graphs of at most 60 nodes. The tests reproduce Figure 4 exactly, compare the power iteration with an exact dense-matrix computation in fractions on 500 random graphs, check the escape bound, and measure the ranking on graphs with two regions and 2 attack edges: in 40 graphs with 30 honest and 30 Sybil nodes, all 1200 Sybils fell in the bottom 30 places (measurement).

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

sybilrank.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/sybilrank/. The authors are listed in prov/S4HXC8.jsonl.

"""SybilRank (Cao, Sirivianos, Yang and Pregueiro, NSDI 2012, Section 4).

Early-terminated power iteration of trust from honest seeds on an undirected
social graph, then a ranking by degree-normalized trust. The graph is an
adjacency dict of a small synthetic graph; no real account data is used.
"""

from math import ceil, log2
from typing import Hashable, Mapping, Sequence

Node = Hashable


def default_iterations(n: int) -> int:
    """w = ceil(log2 n), the O(log n) early termination of Section 4.2."""
    return max(1, ceil(log2(n))) if n > 1 else 1


def propagate(adj: Mapping[Node, Sequence[Node]], seeds: Sequence[Node], total: float, w: int) -> dict[Node, float]:
    """Trust after w power iterations, starting with total split evenly on the seeds.

    Precondition: every node has at least one neighbor, adj is symmetric, and
    seeds is a nonempty list of distinct nodes. Cost: O(w (n + m)) time and
    O(n) extra space for n nodes and m edges.
    """
    share = total / len(seeds)
    seed_set = set(seeds)
    trust = {v: (share if v in seed_set else 0.0) for v in adj}  # @line L1
    for _ in range(w):  # @line L2
        nxt = {v: 0.0 for v in adj}  # @line L3
        for u, nbrs in adj.items():  # @line L4
            give = trust[u] / len(nbrs)
            for v in nbrs:
                nxt[v] += give
        trust = nxt  # @line L5
    return trust


def rank(adj: Mapping[Node, Sequence[Node]], trust: Mapping[Node, float]) -> list[Node]:
    """Nodes ordered by degree-normalized trust, lowest (most suspect) first.

    Ties are broken by the string form of the node, so the order is
    deterministic. Cost: O(n log n).
    """
    score = {v: trust[v] / len(adj[v]) for v in adj}  # @line L6
    return sorted(adj, key=lambda v: (score[v], str(v)))  # @line L7


def sybilrank(adj: Mapping[Node, Sequence[Node]], seeds: Sequence[Node], total: float = 1.0, w: int | None = None) -> list[Node]:
    """Propagate trust from the seeds for w iterations (default ceil(log2 n)) and rank."""
    if w is None:
        w = default_iterations(len(adj))
    return rank(adj, propagate(adj, seeds, total, w))
test_sybilrank.py 139 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/sybilrank/. The authors are listed in prov/S4HXC8.jsonl.

import random
from fractions import Fraction

from sybilrank import default_iterations, propagate, rank, sybilrank

# The graph of Figure 4 of Cao et al.: A..E are honest, F..I are Sybils, E-F is the attack edge.
EDGES = ["AB", "AC", "BC", "BE", "CD", "DE", "EF", "FG", "FH", "GH", "GI", "HI"]


def build(edges) -> dict:
    adj: dict = {}
    for a, b in edges:
        adj.setdefault(a, []).append(b)
        adj.setdefault(b, []).append(a)
    return {v: sorted(n) for v, n in adj.items()}


def oracle(adj: dict, seeds: list, total: Fraction, w: int) -> dict:
    """Exact trust by w products with the dense transition matrix, in fractions."""
    nodes = sorted(adj, key=str)
    idx = {v: i for i, v in enumerate(nodes)}
    n = len(nodes)
    p = [[Fraction(0)] * n for _ in range(n)]  # p[i][j]: from i to j
    for u in nodes:
        for v in adj[u]:
            p[idx[u]][idx[v]] += Fraction(1, len(adj[u]))
    x = [total / len(seeds) if v in seeds else Fraction(0) for v in nodes]
    for _ in range(w):
        x = [sum(x[i] * p[i][j] for i in range(n)) for j in range(n)]
    return {v: x[idx[v]] for v in nodes}


def test_example() -> None:
    adj = build(EDGES)
    t = propagate(adj, ["C", "D"], 648.0, 4)
    want = {"A": 92, "B": 144, "C": 131, "D": 93, "E": 90, "F": 54, "G": 16, "H": 16, "I": 12}
    for v, x in want.items():
        assert abs(t[v] - x) < 1e-9
    assert oracle(adj, ["C", "D"], Fraction(648), 4) == {v: Fraction(x) for v, x in want.items()}
    order = rank(adj, t)
    assert order[:4] == ["G", "H", "I", "F"]  # every Sybil is below every honest node
    assert set(order[4:]) == set("ABCDE")
    # After many iterations the trust is proportional to degree: 27 per edge end.
    t = propagate(adj, ["C", "D"], 648.0, 200)
    for v in adj:
        assert abs(t[v] - 27 * len(adj[v])) < 1e-6


def test_edges() -> None:
    adj = build(["AB"])
    assert propagate(adj, ["A"], 1.0, 0) == {"A": 1.0, "B": 0.0}
    assert propagate(adj, ["A"], 1.0, 1) == {"A": 0.0, "B": 1.0}
    assert rank(adj, {"A": 0.5, "B": 0.5}) == ["A", "B"]  # ties by name
    assert default_iterations(1) == 1 and default_iterations(2) == 1
    assert default_iterations(9) == 4 and default_iterations(1024) == 10
    assert sybilrank(build(EDGES), ["C", "D"])[:4] == ["G", "H", "I", "F"]


def random_graph(rng: random.Random, n: int) -> dict:
    adj = {v: set() for v in range(n)}
    for v in range(1, n):
        u = rng.randrange(v)
        adj[u].add(v)
        adj[v].add(u)
    for _ in range(rng.randrange(0, 2 * n)):
        a, b = rng.randrange(n), rng.randrange(n)
        if a != b:
            adj[a].add(b)
            adj[b].add(a)
    return {v: sorted(s) for v, s in adj.items()}


def test_random_against_oracle() -> None:
    """Floating power iteration agrees with the exact matrix oracle and keeps the total."""
    rng = random.Random(2012)
    for _ in range(500):
        n = rng.randrange(2, 13)
        adj = random_graph(rng, n)
        seeds = rng.sample(range(n), rng.randrange(1, n + 1))
        w = rng.randrange(0, 6)
        got = propagate(adj, seeds, 1.0, w)
        want = oracle(adj, seeds, Fraction(1), w)
        assert sum(want.values()) == 1
        for v in adj:
            assert abs(got[v] - float(want[v])) < 1e-12


def two_regions(rng: random.Random, nh: int, ns: int, g: int, extra: int) -> tuple[dict, set]:
    """An honest region and a Sybil region, each a random connected graph, joined by g attack edges."""
    adj = {v: set() for v in range(nh + ns)}

    def add(a: int, b: int) -> None:
        if a != b:
            adj[a].add(b)
            adj[b].add(a)

    for lo, size in ((0, nh), (nh, ns)):
        for v in range(1, size):
            add(lo + v, lo + rng.randrange(v))
        for _ in range(extra * size):
            add(lo + rng.randrange(size), lo + rng.randrange(size))
    attack = set()
    while len(attack) < g:
        e = (rng.randrange(nh), nh + rng.randrange(ns))
        attack.add(e)
        add(*e)
    return {v: sorted(s) for v, s in adj.items()}, attack


def test_escape_bound() -> None:
    """Trust in the Sybil region after w steps is at most the sum, over steps, of the flow on attack edges."""
    rng = random.Random(197)
    for _ in range(200):
        nh, ns = rng.randrange(5, 31), rng.randrange(2, 31)
        adj, attack = two_regions(rng, nh, ns, rng.randrange(1, 4), 2)
        seeds = rng.sample(range(nh), rng.randrange(1, 4))
        w = default_iterations(nh + ns)
        flow = 0.0
        for i in range(w):
            t = propagate(adj, seeds, 1.0, i)
            flow += sum(t[u] / len(adj[u]) for u, _ in attack)
        t = propagate(adj, seeds, 1.0, w)
        assert sum(t[v] for v in range(nh, nh + ns)) <= flow + 1e-12


def test_ranking_measurement() -> None:
    """With few attack edges most Sybils fall in the bottom of the ranking (a measurement, not a bound)."""
    rng = random.Random(210)
    caught = total = 0
    for _ in range(40):
        nh, ns = 30, 30
        adj, _ = two_regions(rng, nh, ns, 2, 3)
        order = sybilrank(adj, rng.sample(range(nh), 3))
        caught += sum(1 for v in order[:ns] if v >= nh)
        total += ns
    assert caught / total > 0.8

History

Yu, Kaminsky, Gibbons and Flaxman introduced social-network Sybil defenses with SybilGuard in 2006, followed by SybilLimit in 2008. Viswanath, Post, Gummadi and Mislove analyzed these defenses in 2010. Cao, Sirivianos, Yang and Pregueiro presented SybilRank at NSDI 2012, replacing random routes by early-terminated power iteration, and reported that at Tuenti about 90% of the 200,000 lowest-ranked accounts were fake (measurement).

References

  1. Qiang Cao, Michael Sirivianos, Xiaowei Yang and Tiago Pregueiro, Aiding the detection of fake accounts in large scale social online services, USENIX NSDI 2012, pages 197 to 210, Section 3 (the model and assumptions), Section 4.2 (trust propagation, early termination and Figure 4), Section 4.2.2 (seeds in several communities with the Louvain method), the security analysis, and the evaluation and the deployment at Tuenti
  2. Haifeng Yu, Phillip B. Gibbons, Michael Kaminsky and Feng Xiao, SybilLimit: a near-optimal social network defense against Sybil attacks, IEEE Symposium on Security and Privacy 2008, pages 3 to 17, doi:10.1109/SP.2008.13, the social network model with g attack edges and a fast-mixing honest region
  3. Bimal Viswanath, Ansley Post, Krishna P. Gummadi and Alan Mislove, An analysis of social network-based Sybil defenses, ACM SIGCOMM 2010, the analysis of social Sybil defenses as ranking by connectivity to trusted nodes

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.average
  • a full proof of time.best
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example