Security in use of contants

T

Todd Benson

(A bunch of stuff about trying to be l33t.)

There are many of ways, peter, to secure Ruby. Maybe, you should ask _why.

That pun is intended.

_why made an open Ruby programming irb interface on the internet. You
can _almost_ do anything you want on that site
(http://tryruby.hobix.com). Constant security, blah.

Todd
 
J

James Gray

""causes a warning""

"This is interesting, do you have a rubydoc link to this topic ? "

And don't forget this Q.

$ ruby -e 'C = "once"; C = "oops"'
-e:1: warning: already initialized constant C

James Edward Gray II
 
L

loolek

"http://tryruby.hobix.com"

This site is a bad ruby "demo", or i dont know. I followed the
instructions ->

type help <- the result is an error

type 2 + 6 <- the result is Bad Gateway error
<html>
<head><title>502 Bad Gateway</title></
head>
<body
bgcolor="white">
<center><h1>502 Bad Gateway</h1></
center>
<hr><center>nginx/0.6.31</
center>
</
body>
</
html>
Where was i wrong ?

peter
 
L

loolek

"$ ruby -e 'C = "once"; C = "oops"'
-e:1: warning: already initialized constant C "

Okay, but i don't decide yet to use ruby or not. So i have not
installed Ruby so far...

So ask again, PLZ send me a RubyDoc link about this topic !

The Google search dosn't fint this frase ->

google says: "Your search - site:rubydoc.org "already initialized
constant" - did not match any documents."

peter
 
L

loolek

Why does loolek feel so much like Ilias? Hmm…
James Edward Gray II

Could you teach me ? -> What is Ilias means in this situation ? I know
Ilias is a good book. But the urbandictionary.com says:

1. Ilias

A person prone to sexual intercourse with an animal; most commonly a
canine.
1. I hope that's his tail you're scratching. I wouldn't have picked
you as an Ilias.

2. Scruffy looks sad. I thought he knew not to play stick with Ilias.

3. I don't trust that Ilias guy. Atleast Rocky's not constipates
anymore.

How could i mean this frase ?

And just an another Q -> what this is mean to me -> l33t ?

Sorry, but i am just an uneducated hungarian guy.

peter
 
L

loolek

Why does loolek feel so much like Ilias? Hmm…
James Edward Gray II

Hmm...

The UrbanDictionary.com says:

1. ilias

A person prone to sexual intercourse with an animal; most commonly a
canine.
1. I hope that's his tail you're scratching. I wouldn't have picked
you as an Ilias.

2. Scruffy looks sad. I thought he knew not to play stick with Ilias.

3. I don't trust that Ilias guy. Atleast Rocky's not constipates
anymore.

How do you mean this ?

peter
 
P

Pit Capitain

2008/8/18 loolek said:
"$ ruby -e 'C = "once"; C = "oops"'
-e:1: warning: already initialized constant C "

Okay, but i don't decide yet to use ruby or not. So i have not
installed Ruby so far...

Peter, in Ruby others can change almost everything that you have
written, and they can change it at runtime, without having access to
your code: constants, classes, methods, instance variables, and so on.
So I think Ruby isn't the right language for you.

Regards,
Pit
 
L

loolek

Peter, in Ruby others can change almost everything that you have
written, and they can change it at runtime, without having access to
your code: constants, classes, methods, instance variables, and so on.
So I think Ruby isn't the right language for you.

Regards,
Pit

"Peter, in Ruby others can change almost everything that you have
written,"

Cool, could you give me a good link for self Ruby education ?

"So I think Ruby isn't the right language for you."

A big no -> i mean: i could decide what good for me and not you !!!

peter
 
P

Pit Capitain

2008/8/18 loolek said:
Cool, could you give me a good link for self Ruby education ?

Peter, I'm sure you'll be able to find the official Ruby homepage and
navigate from there to the introductory documentation. Specific
questions like the not-so-constant constants in Ruby as in this thread
are normally answered here on ruby-talk.
A big no -> i mean: i could decide what good for me and not you !!!

That's exactly why I wrote "I think", not "I decide for you". From
your questions I got the impression that you are looking for a
language which allows you to create tightly sealed programs. On the
other hand, Ruby is one of the most open and flexible languages I
know.

Maybe you can tell us more about what you are really looking for, what
kind of programs you want to create, etc. Many of us here on ruby-talk
know a lot of other programming languages and could tell you what we
think would be the right language for your purposes. Again: of course
it is you who finally has to make the decision.

Regards,
Pit
 
L

loolek

Come on, Captian or Phlip or who ever -> give me a CORRECT link PLZ !

Or i have to think this -> the Ruby lang is not documented well ?

I wrote -> "the google search machine didn't find that error msg @
ruby-doc.org" -> so what's up guys ?

peter
 
P

Peña, Botp

From: loolek [mailto:[email protected]]=20
# I wrote -> "the google search machine didn't find that error msg @
# ruby-doc.org" -> so what's up guys ?

i hope i can help =3D)

http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html
http://www.ruby-doc.org/docs/UsersGuide/rg/constants.html

also, you may want to read about $SAFE variable =
http://www.ruby-doc.org/docs/ProgrammingRuby/html/taint.html

do not worry about documentation (it is only for anglois (guy decoux) =
:). read the ruby source. it's very readable and unambiguous. then once =
you've mastered the source, do not forget to contribute to the ruby =
docs. ruby docs may need improvement, but it is improving.. (ruby is a =
community effort; if you like it, good; if you want to contribute, good; =
if do not like it, good too. your choice as always :)

kind regards -botp
 
P

Pit Capitain

2008/8/19 loolek said:
Come on, Captian or Phlip or who ever -> give me a CORRECT link PLZ !
I wrote -> "the google search machine didn't find that error msg @
ruby-doc.org" -> so what's up guys ?

You have to look better. Google gives me at least the following two
links from ruby-doc to that error message:

http://www.ruby-doc.org/docs/UsersGuide/rg/constants.html
http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html

And as a bonus here's a direct link to the very part of the second
page with the error message:

http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html#S4

Not too hard to find, isn't it?

Regards,
Pit
 
D

David Masover

a. May be ter*rist or whatever, don' really matter. But they are only
one guy.

"Them", then. I was referring to one guy.
"get the ability to "overwrite" it?"

Secound, play that -> i am the bad guy...

a. I was won the ruby programmer job at the plant -> I'm in!

You won the Ruby programmer job at the plant.

Congratulations, you can now edit the Ruby source code where that constant was
defined! It really doesn't matter at this point.
b. I hacked the box of the security guy of the plant (home machine).
Why? Becouse he/she is got connection to the inner plant network
(SSH). So i am in again! (idea from Kevin)

Again, you've SSH'd in to the machine... Now, what, exactly, is stopping you
from simply killing that process, editing the source (maybe copying it to a
temporary location), and running it again?
e. Should i continue?

The rest of your examples only highlight the problem:

Once you're in, you're in. What possible scenario could he insert Ruby code
into a running process, without being able to also change the constant
anyway?

And what possible language could he not do this in? It's harder to change a
constant in a running C program, but one buffer overflow and you can do it.
"let alone in my memory space."

Hmm, how do you mean this? The ruby code will guard the memory/
hardware/io/etc. I really don't get you?

Well, I'm assuming that if he can modify a Ruby program that is executing, he
is doing so by editing its memory -- which means he has access to the memory
space of the program.

Which means that no matter what language the program is written in, he can now
change any part of it, full stop.

I suppose it's possible that you're stupid enough to use eval in places you
shouldn't. That's the only other way I can think of.
But anyway -> i was first hacked the unpatched Linux kernel... Should
i continue the "how"?

Great -- so you can now modify ANY memory, ANYWHERE on the system.

Again: NO language will protect ANY so-called "constant" from being modified
here -- except maybe Verilog.

Do you know why Verilog can? Because it compiles to hardware -- meaning the
only possible way to change the constant would be with a soldering iron.

Do you know why it's "maybe"? Because if any part of the program is software,
and needs that constant, you can always change the one line that reads the
constant from hardware to read a different value instead.
"WE are saying is that you are wrong about how to go about being
secure."

I think "hypotheticaly" -> i am right. In other words, you STILL don't
see the DANGER that the week coding language cousing?

That's not an argument. This has officially descended into "No it's not! Yes
it is!"

I don't think it's a "week coding language". You do. Unless you're willing to
say _why_ you think it's weak, we aren't going to get beyond name-calling.

And I'm not going to respond to any more trolling from you.
"hell of a lot worse than "overwriting a constant""

Oh yes, i see now -> you don't smell the dager still, becouse you
asking this silly Q. But okay, what worse could happen?

No, missing the point:

If he can get into a situation where it's possible for him to modify a Ruby
constant, that kind of implies that he can do ANYTHING to the Ruby program,
through any of the methods you mentioned above.

Which means that if he wants to make it go boom, he can still do all of the
following:
a. You are dead.
b. Your home city is dead too.
c. You mom is dead too.
d. The water in your area is posioned for a long time.
e. etc.

What was the point of listing them?

Again, these are not caused by Ruby. These are caused by the fundamental
nature of how modern operating systems work.

If anyone can get their code ANYWHERE NEAR your hypothetical nuclear reactor,
they damned well better be trusted.

If your nuclear reactor isn't hypothetical, quit now.




One example: Suppose you've somehow gotten this figured out, and you have your
constants.rb file, which almost no one has access to. In there, you have:

COOLING_TOLERANCE = 12345

Your attacker realizes that they can't change that file, and they can't change
the constant in the program. Fine, so he goes and edits cooling_rods.rb,
where the constant is actually used. He replaces this line:

lower_rods if temp >= COOLING_TOLERANCE

With this one:

raise_rods

Ok, so you make cooling_rods.rb readonly. Fine, so he goes anywhere else in
the program, and edits a file he's allowed to edit, and adds the following:

loop { raise_rods }

Again, you could sandbox it properly. You could make sure that his code never
gets to touch the raise_rods function. But you're always going to miss
something -- maybe he's just a designer, writing the UI. So he goes in and
swaps these two buttons:

START REACTION
EMERGENCY SHUTDOWN

So now, when someone needs to perform an emergency shutdown, they push START
REACTION instead, and the reactor goes boom.

The right solution is to simply not let him touch the program that controls
the cooling rods. Let him read log output from that program to build his
pretty graphs.
 
P

Phlip

David said:
What was the point of listing them?

To pad the post out without the need to learn or pull in any actual programming
details.
And I'm not going to respond to any more trolling from you.

You appear to be the last one! (-:
 
D

David Masover

David Masover wrote:

You appear to be the last one! (-:

Today, at a cafe, I asked "Can I order..."

And she deadpanned "No."

AND I BOUGHT IT!!

I'm so easily trolled :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top