473,503 Members | 3,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dangling pointers and security

I would like to know in what manner dangling pointers affect the
security of a application developed using C++.What are the loopholes
that are created by dangling pointers and how they could be exploited
by hackers?.

Aravind
Jul 22 '05 #1
13 3060
Aravind wrote:

I would like to know in what manner dangling pointers affect the
security of a application developed using C++.What are the loopholes
that are created by dangling pointers and how they could be exploited
by hackers?.


Do you have any idea what 'dangling pointers' are?
--
Karl Heinz Buchegger
kb******@gascad.at
Jul 22 '05 #2
Aravind posted:
I would like to know in what manner dangling pointers affect the
security of a application developed using C++.What are the loopholes
that are created by dangling pointers and how they could be exploited
by hackers?.

Aravind

You are way way wayyyyyyyy off!
First, what do hackers do? They access computers and networks via the
Internet and do things that you don't want them to do.

How do you stop them? Don't give them the ability in the first place!
Sounds simple? So why do people get "hacked"? Mainly because Microsoft is
stupid; it enables things like "file sharing" and "printer sharing" via the
internet protocol TCP/IP. Hackers exploit the ability *that has explicitly
been given to them*.
Now, dangling pointers:

int* pChocolate = new int;

delete pChocolate;

*pChocolate = 5;

That's what a dangling pointer is, and as you can see, it has nothing at all
whatsoever to do with hacking and/or hackers.
Hope that helps.
-JKop
Jul 22 '05 #3
JKop wrote:
First, what do hackers do? They access computers and networks via the
Internet and do things that you don't want them to do.


Actually, they don't. That's what the media made out of the word
"hacker". A hacker is actually just a programmer who is good at
programming and who likes it.

Jul 22 '05 #4
Rolf Magnus wrote:
JKop wrote:

First, what do hackers do? They access computers and networks via the
Internet and do things that you don't want them to do.

Actually, they don't. That's what the media made out of the word
"hacker". A hacker is actually just a programmer who is good at
programming and who likes it.


My understanding (or definition) of hacker is one who attempts
a task without reading or finding out how to do it first.

When I was growing up, hackers would figure out how to log into
other computers and browse. No malicious intent, just bragging
rights. Other hackers would attempt to write editors starting
from the bottom up without any pre-design.

At some point in time, hacker was designated with a negative
conontation (sp!). This was due to the few who were malicious.
Now, the malicious ones are hired by "The Dark Side" for
"evil purposes".

So much for being able to play "Global Thermonuclear War"
on the "Wombat" computer. "Want to play a game?"

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #5
Thomas Matthews wrote:
Rolf Magnus wrote:
JKop wrote:

First, what do hackers do? They access computers and networks via the
Internet and do things that you don't want them to do.

Actually, they don't. That's what the media made out of the word
"hacker". A hacker is actually just a programmer who is good at
programming and who likes it.


My understanding (or definition) of hacker is one who attempts
a task without reading or finding out how to do it first.

When I was growing up, hackers would figure out how to log into
other computers and browse. No malicious intent, just bragging
rights. Other hackers would attempt to write editors starting
from the bottom up without any pre-design.


Yes, something like that. For doing that, you would need to be very good
at programming and also like it, so it's more or less consistent with
my definition. I just couldn't put it in words as good as you could.
At some point in time, hacker was designated with a negative
conontation (sp!). This was due to the few who were malicious.
Now, the malicious ones are hired by "The Dark Side" for
"evil purposes".
And now, most people only know those malicious ones, because they are in
the media, and movies and novels are written about them.
Only few people would realize that the "Linux Kernel Hacker's Guide" is
not about breaking into linux systems.
So much for being able to play "Global Thermonuclear War"
on the "Wombat" computer. "Want to play a game?"


--
"computer games don't affect kids. I mean if pac man affected us as
kids, we'd all run around in a darkened room munching pills"

Jul 22 '05 #6
My understanding (or definition) of hacker is one who attempts
a task without reading or finding out how to do it first.
the definition of hacker i've always known is someone who does something
unorthodox and/or inelegant, just to get something done. bypassing
passwords to enter a secure area is a little unorthodox, so the
definition extends to cover that group.
When I was growing up, hackers would figure out how to log into
other computers and browse. No malicious intent, just bragging
rights. Other hackers would attempt to write editors starting
from the bottom up without any pre-design.

Yes, something like that. For doing that, you would need to be very good
at programming and also like it, so it's more or less consistent with
my definition. I just couldn't put it in words as good as you could.


i agree except that you don't necessarily *need* to be good at
programming (or even fond of it) to hack a working program together. it
would probably be a mess, and an embarrasment to any professional
programmer with dignity, but it would work.

that said, the best hackers would tend to be ones who are very good,
because they would be the ones thinking outside the box.

to me, a hacker is someone who "just gets it done, and damn the
torpedos". that doesn't necessarily imply competence or enjoyment,
although there will be a high degree of correlation. hacker is a kind of
play derogatory, too. both a hacker and a very good programmer may get a
job done, but only the good programmer should be proud of his work.
At some point in time, hacker was designated with a negative
conontation (sp!). This was due to the few who were malicious.
Now, the malicious ones are hired by "The Dark Side" for
"evil purposes".

And now, most people only know those malicious ones, because they are in
the media, and movies and novels are written about them.
Only few people would realize that the "Linux Kernel Hacker's Guide" is
not about breaking into linux systems.


there's a whole subculture with it's own parlance and jargon that
differentiates between hacker, crackers, phreakers, sneakers and so on.
i don't know all the subtleties of it, but i believe that the kind of
person who breaks into things is a cracker. they may or may not have
hacked their way in, depending on the elegance of the method, but in the
end, the result is that they've cracked the system - not "hacked" the
system.
So much for being able to play "Global Thermonuclear War"
on the "Wombat" computer. "Want to play a game?"


bonus points for obscure pop culture reference ^_^

for the record, i have never heard of any instance when a dangling
pointer caused a security issue - and i have no idea how one could be
(except by a monumental fluke, and even then, it would likely not be a
deterministically reproducable problem). crashes, yes. odd behaviour,
yes. buffer overruns on the other hand....

mark

Jul 22 '05 #7
Thomas Matthews wrote:
Rolf Magnus wrote:
JKop wrote:

First, what do hackers do? They access computers and networks via the
Internet and do things that you don't want them to do.

Actually, they don't. That's what the media made out of the word
"hacker". A hacker is actually just a programmer who is good at
programming and who likes it.


My understanding (or definition) of hacker is one who attempts
a task without reading or finding out how to do it first.


http://www.xemacs.org/Documentation/...ls_1.html#SEC1

1. A History of Emacs

XEmacs is a powerful, customizable text editor and development environment.
It began as Lucid Emacs, which was in turn derived from GNU Emacs, a
program written by Richard Stallman of the Free Software Foundation. GNU
Emacs dates back to the 1970's, and was modelled after a package called
"Emacs", written in 1976, that was a set of macros on top of TECO, an old,
old text editor written at MIT on the DEC PDP 10 under one of the earliest
time-sharing operating systems, ITS (Incompatible Timesharing System). (ITS
dates back well before Unix.) ITS, TECO, and Emacs were products of a group
of people at MIT who called themselves "hackers", who shared an idealistic
belief system about the free exchange of information and were fanatical in
their devotion to and time spent with computers. (The hacker subculture
dates back to the late 1950's at MIT and is described in detail in Steven
Levy's book Hackers. This book also includes a lot of information about
Stallman himself and the development of Lisp, a programming language
developed at MIT that underlies Emacs.)
--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
Jul 22 '05 #8
Aravind wrote:

I would like to know in what manner dangling pointers affect the
security of a application developed using C++.What are the loopholes
that are created by dangling pointers and how they could be exploited
by hackers?.

Aravind


Dangling pointer:
http://catb.org/~esr/jargon/html/D/d...g-pointer.html

In a language such as C++, a dangling pointer isn't particularly a problem, in
and of itself. In languages where pointers are abstracted away (e.g. Java),
there can be all sorts of negative consequences because of the implied notion
that a pointer only points to something valid (or possibly null).

Common code practices indicate that a pointer should either: point to something
valid, or be set to null. Under this practice, usage of a valid pointer will
result in defined behavior, usage of a null pointer will result in an exception
or program termination. However, using a dangling pointer is completely
undefined, and there is where a potential problem can be exploited, but it is
going to be very system specific behavior.

So, suppose that there is a system & application where it is known that there
is some sequence of steps that results in (internally) a dangling pointer.
Additionally, occasionally that dangling pointer may eventually point to a
portion of memory that contains security (access-control) related information.
That dangling pointer, could then conceivable be exploited to be used to write
to (what is presumed) secure parts of memory, changing access control, and
possibly granting additional (unintended) access to the user.

Note that this is only one scenario, there is no single or unified answer to
your question.
Jul 22 '05 #9
Julie posted:
So, suppose that there is a system & application where it is known that
there is some sequence of steps that results in (internally) a dangling
pointer.
int* pBozo = new int;

delete pBozo;

//AHHH!!!! Dangling pointer!
Additionally, occasionally that dangling pointer may
eventually point to a portion of memory that contains security
(access-control) related information.

pBozo = GenerateSuperDuperRandomMemoryAddress();

That dangling pointer, could then
conceivable be exploited to be used to write to (what is presumed)
secure parts of memory, changing access control, and possibly granting
additional (unintended) access to the user.

BULL

SHIT

BULL

SHIT

Note that this is only one scenario, there is no single or unified
answer to your question.



Dangling pointers are not a problem at all whatsoever.
-JKop
Jul 22 '05 #10
JKop wrote:
<trash snipped>

Nice attitude. You are going to go far.
Jul 22 '05 #11

Good day, Julie,

After ignoring lousy attitudes and snipping trash, sometimes even the
biggest schmucks can have a point. The behaviour of accessing dangling
pointers is, as you pointed out, undefined. However, the behaviour of
the preceding delete is quite well-defined.

For example assume that you have previously "new"ed some kind of
certificate or a key to allow access to a restricted resource. After
using it, you call delete on this pointer, but do not get rid of it
completely. You have a dangling pointer problem now.

But is it a security risk? I doubt that. If the code worked at all then
that resource - the certificate or key - should have been invalidated
before the memory was deallocated, either in the destructor, or by an
explicit call before, or both. If not, then your problem isn't a
dangling pointer, it's a resource leak.

While I have to agree that it's not *impossible* for a dangling pointer
to lead to a security breach - due to the nature of undefined behaviour,
a dangling pointer could one day lead to the obliteration of entire
galaxies for all we know (when windows' memory footprint is so large is
must be googol-bytes) - the non-deterministic nature of modern operating
systems would tend to make that a non-reproducable bug.

One would also assume that a "secure" OS would have some way to defend
against random memory writes wreaking havoc anywhere but in the calling
process.

Add to that that any program that could potentially lead to security
breaches would (assumedly) be thoroughly tested - and that dangling
pointers are trivial to detect, I'd say the practical probability is
slim to none and shrinking.

mark

Jul 22 '05 #12
Rolf Magnus wrote:
JKop wrote:
First, what do hackers do? They access computers and networks
via the Internet and do things that you don't want them to do.
Actually, they don't.
That's what the media made out of the word "hacker".
A hacker is actually just a programmer
who is good at programming and who likes it.


No.

The word hacker is a pejorative term used to describe someone
(a programmer for instance) who succeeds through persistence
without really knowing what he (or she) is doing.
For example, a person who breaks into other peoples'
computer accounts by guessing their passwords is a hacker.
A programmer who guesses at the semantics and syntax of a library
function call correctly without every consulting a manual is a hacker.

Think of an ill prepared camper who forgets to bring a hatchet or saw
and ends up hacking tree limbs (for firewood) with a Swiss army knife.

Steven T. Hatton wrote:
http://www.xemacs.org/Documentation/...ls_1.html#SEC1

1. A History of Emacs

[snip]

This is *not* a definition of hacker. The people at MIT were hackers
because they didn't really know what they were doing and not
because they "shared an idealistic belief system".
For the sake of respectability in this case, modern researchers
might wish to substitute the term *experimentalist* for hacker.
Jul 22 '05 #13
In message <c9*********@nntp1.jpl.nasa.gov>, E. Robert Tisdale
<E.**************@jpl.nasa.gov> writes
Rolf Magnus wrote:
JKop wrote:
First, what do hackers do? They access computers and networks via the
Internet and do things that you don't want them to do.

Actually, they don't. That's what the media made out of the word
"hacker".
A hacker is actually just a programmer who is good at programming
and who likes it.


No.

The word hacker is a pejorative term


No. From the Jargon File:

hacker: n.
1. A person who enjoys exploring the details of programmable
systems and how to stretch their capabilities, as opposed to most users,
who prefer to learn only the minimum necessary. RFC1392, the Internet
Users' Glossary, usefully amplifies this as: A person who delights in
having an intimate understanding of the internal workings of a system,
computers and computer networks in particular.

2. One who programs enthusiastically (even obsessively) or who
enjoys programming rather than just theorizing about programming...

[and much more]

http://www.catb.org/~esr/jargon/html/H/hacker.html

cf.

cracker: n.
One who breaks security on a system. Coined ca. 1985 by hackers in
defense against journalistic misuse of hacker (q.v., sense 8). An
earlier attempt to establish worm in this sense around 1981--82 on
Usenet was largely a failure...
http://www.catb.org/~esr/jargon/html/C/cracker.html

--
Richard Herring
Jul 22 '05 #14

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

Similar topics

11
1911
by: John | last post by:
Hi: Below is a simple code: class link1 { public: link1(); link1(int &b1, double &b2); int* a1;
20
6522
by: __PPS__ | last post by:
Hello everybody in a quiz I had a question about dangling pointer: "What a dangling pointer is and the danger of using it" My answer was: "dangling pointer is a pointer that points to some...
5
1957
by: Richard | last post by:
My experience has always been that you're SOL when trying to safely detect and stop references to dangling memory (non-null pointers to free'ed blocks) at runtime (C99, Linux). Maybe somebody...
3
3645
by: shivapadma | last post by:
1.when referenced pointer is not active then it is called dangling pointer. is this correct ? 2.the pointer which does not point to anything is called null pointer. is NULL macro is a...
3
1798
sicarie
by: sicarie | last post by:
I saw this on Slashdot and thought it was interesting. There's no released POC as far as I know, but i was curious. How do you guys find things like dangling pointers? (Blackbox testing, trusting the...
1
1500
by: vsrinivas | last post by:
what is dangling pointer ?And when it will occur in applications?
1
2452
by: sridhard2406 | last post by:
Hi All, I have a doubt on undrestanding Dangling pointers.Below I mentioned sample code. please let me know, my view on Dangling pointers is correct or not? main( ) ...
8
2017
by: Rafael Anschau | last post by:
I read that you should assign null (0) to all pointers that you call delete on. Does that mean: *p=0(set the value pointed to to 0). or p=0(set the address held to zero).
0
7261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6974
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...
0
7445
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...
0
5559
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,...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3158
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...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.