Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7584051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:49:44+00:00 2026-05-30T18:49:44+00:00

I have simple C program: char user_input[100]; scanf(%s, user_input); printf(user_input); It is my understanding

  • 0

I have simple C program:

char user_input[100];
scanf("%s", user_input);
printf(user_input);

It is my understanding this represents security vulnerability; e.g. inputing a bunch of %x will print out the stack’s content.

But how could one print a chosen memory location?

I read that:

\x10\x01\x48\x08_%08x.%08x.%08x.%08x.%08x|%s|

Should be dumping the memory’s content at the location 0x08480110 from this paper. But instead, it is printing out the very next 4bytes to the format string on the stack. I’m trying to understand why.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:49:45+00:00Added an answer on May 30, 2026 at 6:49 pm

    The format string itself will be on the stack (as you’ve declared user_input as a local variable). So if you walk the stack far enough (which is what the %08x force printf to do), then you will eventually arrive at the beginning of the format string. %s tells printf to read an address from the stack, and then print the string found at that location. So it reads the first 4/8 bytes of the format string, and uses those as the address.

    Of course, for this to work, you need to know exactly how far to read through the stack in order to hit the format string. So you may need to adjust the number of %08x.

    Also, a user entering \x10 at run-time is not the same as a string literal in your source code that contains \x10…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this following simple program: int main() { char* v = getenv(TEST_VAR); cout
I have written this simple C program that changes the rotation file name. Eg:
I have a simple program which creates a thread, and waits when this thread
I have a very simple program but this is giving me a seg fault.
I have this simple C program: #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <time.h>
Say I have simple program that emulates a board game with a number of
I have a simple program that creates a thread, loops twenty times and then
I have a simple program to check if a port is open, but I
I have a simple python program that I'd like to daemonize. Since the point
I have a simple forms program that I have been fighting with for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.