IP Library › Granted Patent US 12,265,608
Granted Patent B2
US 12,265,608 · App. 17/928,995 · Granted Apr 1, 2025

Stack protection

Inventors: Naveed Ahmed (Singapore, SG); Prasanna Hegde (Singapore, SG)
Assignee: THALES DIS FRANCE SAS
G06F21/54G06F21/554G06F2221/033
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,265,608
App. No.
17/928,995
Granted
Apr 1, 2025
Kind
B2
Abstract

The present invention relates to a method for protecting a program in a computer system, the method comprising: when a subroutine of said program is called, pushing a return address on to a stack to start forming a stack frame; when pushing said return address, generating a checksum for said stack frame; each time a predetermined opcode is detected for said subroutine, updating said checksum according to an operand associated with said predetermined opcode; if the predetermined opcode is a pop opcode, in addition to said updating, determining whether the operand associated with said pop opcode is said return address; if it is determined that said operand is said return address, verifying said checksum before executing said predetermined opcode in order to detect an attack.

Claims (41)

1. A method for protecting a program in a computer system, the method comprising:

when a subroutine of said program is called, pushing a return address on to a stack to start forming a stack frame;

when pushing said return address, generating a checksum for said stack frame;

each time a predetermined opcode is detected for said subroutine, updating said checksum according to an operand associated with said predetermined opcode;

if the predetermined opcode is a pop opcode, in addition to said updating, determining whether the operand associated with said pop opcode is said return address;

if it is determined that said operand is said return address, verifying said checksum before executing said predetermined opcode in order to detect an attack;

when generating said checksum, initializing said checksum to have a predetermined value and adding said return address's value to said predetermined value;

when updating said checksum;

if said predetermined opcode is a push opcode, adding said operand to the current value of said checksum;

if said predetermined opcode is a load opcode or a pop opcode, subtracting said operand from the current value of said checksum;

when verifying said checksum, checking whether the current value of said checksum is equal to said predetermined value; and

if said checksum is equal to said predetermined value, determining that there is no attack; otherwise, determining that there is an attack.

2. The method according to claim 1 , wherein said predetermined opcode is any one chosen from a group comprising a push opcode, a load opcode, and a pop opcode.

3. The method according to claim 1 , wherein the method further comprises:

introducing a pointer pointing to said checksum;

each time a new subroutine is called, operating said pointer to point to a new checksum generated for a new stack frame corresponding to said new subroutine;

when it is to update or verify the checksum, updating or verifying the checksum said pointer points to; and

each time after verifying the checksum, operating said pointer to point to the checksum of the stack frame of the caller of the subroutine.

4. The method according to claim 1 , wherein said checksum is generated and stored in a Random Access Memory RAM.

5. The method according to claim 1 , wherein said pointer is introduced in a Central Processing Unit CPU's internal register.

6. The method according to claim 1 , wherein the method further comprises:

if the checksum verification result is negative, stopping execution of said program.

7. A method for protecting a program in a computer system, the method comprising:

when a subroutine of said program is called, pushing a return address on to a stack to start forming a stack frame;

when pushing said return address, generating a checksum for said stack frame;

each time a predetermined opcode is detected for said subroutine, updating said checksum according to an operand associated with said predetermined opcode;

if the predetermined opcode is a pop opcode, in addition to said updating, determining whether the operand associated with said pop opcode is said return address;

if it is determined that said operand is said return address, verifying said checksum before executing said predetermined opcode in order to detect an attack;

creating new opcodes which extend said predetermined opcodes, the new opcodes comprising:

a new push opcode that extends a push opcode to generate the checksum and/or update the checksum;

a new load opcode that extends a load opcode to update the checksum;

a new pop opcode that extends a pop opcode to update the checksum and/or verify the checksum; and

applying the new opcodes to the entire program or sensitive part of said program.

8. The method according to claim 7 , wherein the new push opcode further extend the push opcode to operate a pointer to point to the currently activate checksum, and wherein the new pop opcode further extends the pop opcode to operate a pointer to point to the currently activate checksum.

9. A method for protecting a program in a computer system, the method comprising:

when a subroutine of said program is called, pushing a return address on to a stack to start forming a stack frame;

when pushing said return address, generating a checksum for said stack frame;

each time a predetermined opcode is detected for said subroutine, updating said checksum according to an operand associated with said predetermined opcode;

if the predetermined opcode is a pop opcode, in addition to said updating, determining whether the operand associated with said pop opcode is said return address;

if it is determined that said operand is said return address, verifying said checksum before executing said predetermined opcode in order to detect an attack; and

when detecting an opcode instructing to access data in a loop, loading the data from the stack only once, storing the data in a register, and accessing the data from the register in a loop.

Assignments (4)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 12, 2025
From: HEGDE, PRASANNA
To: THALES DIS (SINGAPORE) PTE LTD
Reel/Frame 070189/0189 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 12, 2025
From: AHMED, NAVEED
To: THALES DIS (SINGAPORE) PTE LTD
Reel/Frame 070189/0292 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 12, 2025
From: THALES DIS (SINGAPORE) PTE LTD
To: THALES DIS FRANCE SA
Reel/Frame 070189/0380 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 12, 2025
From: THALES DIS FRANCE SA
To: THALES DIS FRANCE SAS
Reel/Frame 070189/0418 →
Priority Claims (1)
EP 20315293 · Jun 2, 2020 · regional
Continuity (1)
Related Publication 20230222213A1 · Jul 13, 2023
References Cited (9)
US 7546587B2 · Marr · 2009 [cited by examiner]
US 10037212B2 · Porosanu · 2018 [cited by examiner]
US 20040168078A1 · Brodley · 2004 [cited by examiner]
US 20090328231A1 · Gonzalvo · 2009 [cited by examiner]
US 20190227953A1 · Trivedi · 2019 [cited by examiner]
EP 3040895A1 · 2016 [cited by applicant]
International Search Report (PCT/ISA/210) and Written Opinion (PCT/ISA/237) mailed on Sep. 9, 2021 by the European Patent Office as the International Searching Authority for International Application No. PCT/EP2021/0646… [cited by applicant]
Habibi Javid et al: “DisARM: Mitigating 1-11 Buffer Overflow Attacks on Embeddeci Devi ces”, Nov. 6, 2015 (Nov. 6, 2015), Big Data Analytics in the Social and Ubiquitous Context : 5th International Workshop on Modeling … [cited by applicant]
Cari Burch: “ARM subroutines & program 1-11 stack”, Oct. 1, 2012 (Oct. 1, 2012), XP055742024, Retrieved from the Internet: URL: http : //www. toves . org/books/armsub/ [retrieved on Oct. 20, 2020] the whoie document [5 … [cited by applicant]