473,326 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Assume program under constant attack


Usually someone writes a program and guarantees its behaviour so
long as people don't deliberately go and try to make it malfunction.

For instance, let's say we have a "Proceed" button on the dialog
box, but that this button is greyed out because the user hasn't entered
their username yet. Now let's say the user writes some code that sends a
message to the dialog box to enable the "Proceed" button even tho the
programmer didn't design the program to work correctly if "Proceed" is
clicked without there being a valid username.

So anyway, the user clicks "Proceed", the program crashes. The user
complains to the author and the author just replies "If you're gonna do
stuff like that then you can expect the thing to crash".

But what if you were writing programs which were expected to be
under constant attack? One such genre of programs would be a network
daemon. Let's say we've written a network daemon for FTP. On the other
side of the world, a hacker sends a dodgy FTP request which leads to a
buffer overflow. Presumably the hacker has the exectuable file himself
for this daemon and has observed what will happen when the buffer
overflow occurs, and tailors his input to arrange the machine code to do
exactly what he wants, e.g. call a function which will bring up a
command prompt shell for him.

I've read a bit about many of the exploits against Microsoft's
daemons, and a lot of them tend to be as a consequence of buffer
overrun. There was one such well-known buffer overrun in their file-
sharing daemon that allowed a hacker to bring up a command prompt shell
on their own machine and basically do whatever they wanted from there.

But anyway... back to programming...

I'm wondering what way people program the daemon functions which are
the interface to the outside world. Do they check every little detail of
the input scrutinously? Do they check string lengths and array indices
scrutinously? What kind of things do they watch out for? When writing
every line of code, do they be thinking in their head "Someone wants to
break this"?

--
Tomás Ó hÉilidhe
Jan 19 '08 #1
6 1478
Tomás Ó hÉilidhe wrote:
>
.... snip ...
>
I'm wondering what way people program the daemon functions which
are the interface to the outside world. Do they check every little
detail of the input scrutinously? Do they check string lengths and
array indices scrutinously? What kind of things do they watch out
for? When writing every line of code, do they be thinking in their
head "Someone wants to break this"?
If they don't check, someone or thing will break.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com

Jan 19 '08 #2
On Sat, 19 Jan 2008 11:43:21 GMT, "Tomás Ó hÉilidhe" <to*@lavabit.com>
wrote in comp.lang.c:

....absolutely nothing at all about the C language.

I'd suggest you look for a group where this would be topical. Perhaps
news:comp.programming.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Jan 20 '08 #3
On Jan 19, 6:43*am, "Tomás Ó hÉilidhe" <t...@lavabit.comwrote:
* * Usually someone writes a program and guarantees its behaviour so
long as people don't deliberately go and try to make it malfunction.

* * For instance, let's say we have a "Proceed" button on the dialog
box, but that this button is greyed out because the user hasn't entered
their username yet. Now let's say the user writes some code that sends a
message to the dialog box to enable the "Proceed" button even tho the
programmer didn't design the program to work correctly if "Proceed" is
clicked without there being a valid username.

* * So anyway, the user clicks "Proceed", the program crashes. The user
complains to the author and the author just replies "If you're gonna do
stuff like that then you can expect the thing to crash".

* * But what if you were writing programs which were expected to be
under constant attack? One such genre of programs would be a network
daemon. Let's say we've written a network daemon for FTP. On the other
side of the world, a hacker sends a dodgy FTP request which leads to a
buffer overflow. Presumably the hacker has the exectuable file himself
for this daemon and has observed what will happen when the buffer
overflow occurs, and tailors his input to arrange the machine code to do
exactly what he wants, e.g. call a function which will bring up a
command prompt shell for him.

* * I've read a bit about many of the exploits against Microsoft's
daemons, and a lot of them tend to be as a consequence of buffer
overrun. There was one such well-known buffer overrun in their file-
sharing daemon that allowed a hacker to bring up a command prompt shell
on their own machine and basically do whatever they wanted from there.

* * But anyway... back to programming...

* * I'm wondering what way people program the daemon functions which are
the interface to the outside world. Do they check every little detail of
the input scrutinously? Do they check string lengths and array indices
scrutinously? What kind of things do they watch out for? When writing
every line of code, do they be thinking in their head "Someone wants to
break this"?

--
Tomás Ó hÉilidhe
Check everything and, at least thru Beta make sure every error
condition is reported, I once had to according to strict NSA code
constraints we weren't allowed to use recursion--there was a check at
the entry and exit of each function to insure that the function had
only been entered and exited once.That being said, this is for a
different group
Jan 20 '08 #4
On Sat, 19 Jan 2008 08:47:32 -0500, CBFalconer <cb********@yahoo.com>
wrote:
>Tomás Ó hÉilidhe wrote:
>When writing every line of code, do they be thinking in their
head "Someone wants to break this"?
Yes.

Jim
Jan 20 '08 #5
Jack Klein:
On Sat, 19 Jan 2008 11:43:21 GMT, "Tomás Ó hÉilidhe" <to*@lavabit.com>
wrote in comp.lang.c:

...absolutely nothing at all about the C language.


Never written a C program?
--
Tomás Ó hÉilidhe
Jan 20 '08 #6
On Sat, 19 Jan 2008 05:43:21 -0600, Tomás Ó hÉilidhe wrote
(in article <Xn***************************@194.125.133.14>):
I'm wondering what way people program the daemon functions which are
the interface to the outside world. Do they check every little detail of
the input scrutinously? Do they check string lengths and array indices
scrutinously? What kind of things do they watch out for? When writing
every line of code, do they be thinking in their head "Someone wants to
break this"?
Pretty much, they either do, or they get burned. There is a good book
that gives some insight into some of this, sort of from the "black hat"
perspective.

It's called "The Shellcoder's Handbook". If you aren't upon on the
slang, you might think that has something to do with shell scripting.
Not true at all. See if your bookstore has a copy and take a peek and
see if it's what you're looking for.

--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw

Jan 20 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Will Stuyvesant | last post by:
I never used the popen or popen2 libraries but it is my understanding that they can capture the output of console based programs. Is it also possible to send keystrokes to console base programs? ...
9
by: John Cho | last post by:
// CHO, JOHN #include<iostream> class fracpri{ int whole; int numer; int denom;
5
by: Henry Jordon | last post by:
hello I was wondering if someone could help me get a main going on this project I've completed the header file that the professor started us on but not really sure how to get the main going. If...
4
by: Eric Lilja | last post by:
Is this an invalid program? Doesn't compile on my system: #include <cstdio> class Why { enum TArch {LITTLE_ENDIAN, BIG_ENDIAN, NON_IEEE}; TArch Architecture; }; int
23
by: JoeC | last post by:
I am a self taught programmer and I have figured out most syntax but desigining my programs is a challenge. I realize that there are many ways to design a program but what are some good rules to...
42
by: Sheldon | last post by:
Hi, This program works when tested with gdb ( see results 1) but when used in a larger program where 12 becomes 1500 there exists a problem when freeing the memory ( see results 2). Can anyone...
13
by: hn.ft.pris | last post by:
Hi: I have the following simple program: #include<iostream> using namespace std; int main(int argc, char* argv){ const double L = 1.234; const int T = static_cast<const int>(L); int arr;
0
by: candra | last post by:
Learn What Hackers Know? -General Hacking Information -Password Security -Scanning, Fingerprinting And Similar Techniques -How Hackers Attack Numerous Internet Services -How Hackers Attack Web...
41
by: simonl | last post by:
Hi, I've been given the job of sorting out a crash in our product for which we have the crash information and an avi of the event (which can't possibly match but more of that later...) (btw this...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.