473,789 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1513
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.co m>
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.progr amming.

--
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.l earn.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.c omwrote:
* * 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********@yah oo.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.co m>
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
3005
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? I would like to program a Python program that can play for instance the tty version of nethack 3.4.3 on Windows, simulating a human player: for nethack it would not be possible to know if a human or a computer program is playing it. It is a...
9
2306
by: John Cho | last post by:
// CHO, JOHN #include<iostream> class fracpri{ int whole; int numer; int denom;
5
1783
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 someone could please give me some pointers it would greatly be appreciated. Again thanks for the help. Henry headerfile:
4
13611
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
2393
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 follow for creating a program? I am writing a map game program. I created several objects: board object that is an array of integers each number 0-5 is a kind of terrain, a terrain object that is an array of terrain types and each number of...
42
2152
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 give any advise here? -------------------------------------------------- #include <stdlib.h> #include <stdio.h> int main(void) {
13
27442
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
1989
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 Servers, Cgis, PHP, ASP, Etc -How Hackers Attack IRC, Instant Messaging, And Multiplayer Games -Vulnerabilities Found In Platforms With Smaller Market Share -How Hackers Attack Novell And Networks
41
2856
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 is a single threaded VC9 / win32 app) The call stack for the bug effectively goes void* myBuf;
0
9659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9504
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10134
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9977
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9011
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5413
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5545
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4084
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3692
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.