viruses
Luite van Zelst
Institute for Logic, Language and Computation University of Amsterdam
3rd International Workshop on the Theory of Computer Viruses, 2008
1
Motivation
2
Turing machines
Modern Turing machines Turing’s original machine
3
Computer viruses
Interpreted Sequences Cohen’s viruses
“A virus may be loosely defined as a sequence of symbols which, upon interpretation, causes other sequences of symbols to contain (possibly evolved) virus(es).” (Fred Cohen)
The definition
Let M be a Turing machine and V ⊆ Σ∗ then hM, V i ∈ VS if
∀v ∈ V , h ∈ HM (1)
if ∃ n1< ω (2)
∧ h(0) = hs0, _, _i (3)
∧ h(n1) = hs0, t1, p1i (4)
∧ t1[p1, |v |] = v (5)
then ∃ v0∈ V , n2< ω, pos < ω (6)
∧ h(n2) = h_, t2, _i (7)
∧ t[pos, |v0|] = v0 (8)
∧ ∨ pos ≥ p1+ |v | (9)
∨ p1≥ pos + |v0| (10)
∧ ∃ n3< ω (11)
∧ n1< n3< n2 (12)
∧ h(n3) = hs3, t3, p3i (13)
∧ pos ≤ p2≤ pos + |v0| (14)
M Y V I R U S . . .
TM
Contiguous sequences (strings) Any substring on the tape
Uses a special flavour of Turing machines
M Y V I R U S . . .
TM
Contiguous sequences (strings) Any substring on the tape
Uses a special flavour of Turing machines
Depicted
s0 v time n1
v00 time n2
v0 time n3
Literature
Thimbleby et al. in 1998: A Framework for Modelling Trojans and Computer Virus Infection
Mäkinen in 2001: Comment on ‘A Framework for Modelling . . . ’
How are Turing machines defined precisely?
How are ‘interpreted sequences’ defined?
Davis (1958), Minsky (1967), Hopcroft et al. (1979):
Turing machine computes a function:
input M output
On computable numbers, with an application to the Entscheidungsproblem, Turing, 1936
Machine that computes an infinite sequence M
1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 . . .
Davis (1958), Minsky (1967), Hopcroft et al. (1979):
Turing machine computes a function:
input M output
On computable numbers, with an application to the Entscheidungsproblem, Turing, 1936
Machine that computes an infinite sequence M
1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 . . .
Infinite tape
Infinite tape: t : ω → Σ
Finite content: /∈ Σ represents an empty square Infinite tape: t : ω → Σ ·∪ {}
Pure content: PΣ Σ
0 1 0 1 0 . . . PΣ in one-one correspondence with Σ∗
Infinite tape
Infinite tape: t : ω → Σ
Finite content: /∈ Σ represents an empty square Infinite tape: t : ω → Σ ·∪ {}
Pure content: PΣ Σ
0 1 0 1 0 . . . PΣ in one-one correspondence with Σ∗
Infinite tape
Infinite tape: t : ω → Σ
Finite content: /∈ Σ represents an empty square Infinite tape: t : ω → Σ ·∪ {}
Pure content: PΣ Σ
0 1 0 1 0 . . . PΣ in one-one correspondence with Σ∗
Infinite tape
Infinite tape: t : ω → Σ
Finite content: /∈ Σ represents an empty square Infinite tape: t : ω → Σ ·∪ {}
Pure content: PΣ Σ
0 1 0 1 0 . . . PΣ in one-one correspondence with Σ∗
Definition
Structure hQ, Σ, tr , q0i where Q a finite set of states
Σ a finite set of tape symbols q0 starting state
tr is a transition function such that
tr : Q × (Σ ·∪ {}) → Q × Σ × {−1, 0, 1}
Moves
Configurations: hs, t, pi where state: s ∈ Q
tape: t : ω → Σ ·∪ {}
position: p < ω
Moves: hs, t, pi ,→hs0, t0, p0i
Computation
Computations: →M binary relation on infinite tapes t : ω → Σ ·∪ {}
t →M t0 ⇐⇒ hs, t, pi ,→nhs0, t0, p0i /,→
Condition 1: the machine start withhs0, t ∈ PB, 0i Condition 2: The machine does not write :
→M⊆ (PB)2
→M⊆ (Σ∗)2
Computation
Computations: →M binary relation on infinite tapes t : ω → Σ ·∪ {}
t →M t0 ⇐⇒ hs, t, pi ,→nhs0, t0, p0i /,→
Condition 1: the machine start withhs0, t ∈ PB, 0i Condition 2: The machine does not write :
→M⊆ (PB)2
→M⊆ (Σ∗)2
Computation
Computations: →M binary relation on infinite tapes t : ω → Σ ·∪ {}
t →M t0 ⇐⇒ hs, t, pi ,→nhs0, t0, p0i /,→
Condition 1: the machine start withhs0, t ∈ PB, 0i Condition 2: The machine does not write :
→M⊆ (PB)2
→M⊆ (Σ∗)2
Semantics
Basic: |M| : Σ∗ → Σ∗
Function on naturals: encode input and output Representing all functions: one extra ‘erasure’ symbol
Computable Numbers
In 1936, Turing wrote: On computable numbers, with an application to the Entscheidungsproblem.
Real numbers
Binary expansion: π = 11, 001001000011111101 . . . Non integer part: infinite sequence
Computable numbers
Binary expansion written by a machine ? Computable sequences
Computable Numbers
In 1936, Turing wrote: On computable numbers, with an application to the Entscheidungsproblem.
Real numbers
Binary expansion: π = 11, 001001000011111101 . . . Non integer part: infinite sequence
Computable numbers
Binary expansion written by a machine ? Computable sequences
Computable Numbers
In 1936, Turing wrote: On computable numbers, with an application to the Entscheidungsproblem.
Real numbers
Binary expansion: π = 11, 001001000011111101 . . . Non integer part: infinite sequence
Computable numbers
Binary expansion written by a machine ? Computable sequences
Conditions
Mark the left-hand side Figures: ‘output’
Auxiliaries: ‘notes’
F -squares
A contiguous sequence of figures Not erasable (‘write-once’) E -squares
a kind of scratchpad
Conditions
B B
Mark the left-hand side Figures: ‘output’
Auxiliaries: ‘notes’
F -squares
A contiguous sequence of figures Not erasable (‘write-once’) E -squares
a kind of scratchpad
Conditions
B B 0 1 0 1 1
Mark the left-hand side Figures: ‘output’
Auxiliaries: ‘notes’
F -squares
A contiguous sequence of figures Not erasable (‘write-once’) E -squares
a kind of scratchpad
Conditions
B B 0 ∗ 1 $ 0 ∗ 1 ∗ 1 $
Mark the left-hand side Figures: ‘output’
Auxiliaries: ‘notes’
F -squares
A contiguous sequence of figures Not erasable (‘write-once’) E -squares
a kind of scratchpad
Conditions
B B 0 ∗ 1 $ 0 ∗ 1 ∗ 1 $
Mark the left-hand side Figures: ‘output’
Auxiliaries: ‘notes’
F -squares
A contiguous sequence of figures Not erasable (‘write-once’) E -squares
a kind of scratchpad
Conditions
B B 0 ∗ 1 $ 0 ∗ 1 ∗ 1 $
Mark the left-hand side Figures: ‘output’
Auxiliaries: ‘notes’
F -squares
A contiguous sequence of figures Not erasable (‘write-once’) E -squares
a kind of scratchpad
Computed sequence
Computable sequence
0 1 0 1 1 0 1 1 1 0 . . .
Function output
Σ
0 1 0 1 1 0 1 1 1 0 . . .
Computed sequence
Computable sequence
0 1 0 1 1 0 1 1 1 0 . . .
Function output
Σ
0 1 0 1 1 0 1 1 1 0 . . .
Computed sequence
Computable sequence
0 1 0 1 1 0 1 1 1 0 . . .
Function output
Σ
0 1 0 1 1 0 1 1 1 0 . . .
On Turing machines
M Y V I R U S . . .
TM
Can we define a virus as a (contiguous) ‘sequence of symbols’
that is ‘interpreted’ by a Turing machine?
On Turing machines
M Y V I R U S . . .
TM
Can we define a virus as a (contiguous) ‘sequence of symbols’
that is ‘interpreted’ by a Turing machine?
For modern Turing machines
Turing machine: computes a function fully determined by transition function Universal machine:
Computes the universal function
Computes the function of some other machine Defining a Universal machine:
Encode the transition function: ‘program’
Encode the input to this machine: ‘input’
Encodings: injective and therefore decodable
For modern Turing machines
Without specifying ‘valid’ encodings Any machine ‘interprets’ any input Empty string ‘encodes’ the machine itself Entire input ‘encodes’ a constant function Just one program
Interleaving of ‘program’, ‘input’ and simulated tape and temporary symbols
Not every substring of the (total) input is interpreted
For modern Turing’s original machines
Turing’s original machine:
no input
no interpreted sequences Turing’s universal machine:
itself unlike Turing’s original machines
the entire input is the encoding of exactly one machine F - and E -squares: program is not a contiguous sequence on the tape
For modern Turing’s original machines
Turing’s original machine:
no input
no interpreted sequences Turing’s universal machine:
itself unlike Turing’s original machines
the entire input is the encoding of exactly one machine F - and E -squares: program is not a contiguous sequence on the tape
Model at least two programs Non-program cannot be a virus Standard models inadequate New (universal) Turing machine?
No benefit: non standard
Model at least two programs Non-program cannot be a virus Standard models inadequate New (universal) Turing machine?
No benefit: non standard
tape: ω → Σ
infinite tape with infinite content compare with t : ω → Σ ·∪ {}
starting state & position undefined transition function unrestricted
tr : K × Σ → K × Σ × {−1, 0, 1}
even with ∈ Σ finite content undecidable
tape: ω → Σ
infinite tape with infinite content compare with t : ω → Σ ·∪ {}
starting state & position undefined transition function unrestricted
tr : K × Σ → K × Σ × {−1, 0, 1}
even with ∈ Σ finite content undecidable
tape: ω → Σ
infinite tape with infinite content compare with t : ω → Σ ·∪ {}
starting state & position undefined transition function unrestricted
tr : K × Σ → K × Σ × {−1, 0, 1}
even with ∈ Σ finite content undecidable
Not a modern Turing machine
Not Turing’s original (universal) machine All sequences trivially computable
No distinction between figures and auxiliaries No distinction between F -squares and E -squares
Can the difference between Cohen’s machine and modern Turing machines be overcome?
Viral equivalence: M ≡vir N if:
hM, V i ∈ VS ⇐⇒ hN, V i ∈ VS
Viral equivalence is incomparable to functional equivalence
No, it cannot.
Precise definitions essential for Turing machines Turing machines are inappropriate to model viruses Cohen’s modelling non-standard
Outlook
Open door for other modellings of computer viruses Dissect Turing’s machine and unify the two Turing machine models: ‘Talkative Machine’ (TM)
Thank you for your attention!
in
t
out M
M
N
in
t t
out M
M
N
N
≡
vir* ≡
funcM = hQ, Σ, tr , q0i N = hQ, Σ, tr0, q0i Σ = {a, b} Q = {q0, q1} tr (q0, _) = hq1, a, 0i tr0(q0, _) = hq1, b, 0i
Virally equivalent (trivially) No functionally equivalent:
|M|func = t 7→ t[0 7→ a]
|M|func = t 7→ t[0 7→ b]
≡
vir+ ≡
funcTwo machines that compute x 7→ x · 1.
q0
q3
any,any,R
,1,N
q0 q1
q2
q3
any,any,R
,0,N
0,0,N
0,1,N
beamericonbookM. Davis.
Computability and unsolvability.
McGraw-Hill, 1958.
beamericonbookM. Minksy.
Computation : finite and infinite machines.
Prentice-Hall, 1967.
beamericonbookJ. Hopcroft and J. Ullman.
Introduction to Automata Theory, Languages, and Computation.
Addison Wesley, 1979.
beamericonbookB.J. Copeland.
The essential Turing: seminal writings in computing, logic, philosophy, artificial intelligence, and artificial life plus the secrets of enigma.
Oxford University Press, 2004.
beamericonarticleH. Thimbleby, S Anderson and P. Cairns
A Framework for Modelling Trojans and Computer Virus Infection.
Computer Journal, 41: 444-458, 1998.
beamericonarticleE. Mäkinen
Comment on ‘A framework for modelling trojans and computer virus infection’.
Computer Journal, 44(4): 321-323, 2001.