User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion
Register FAQ Members List Calendar Arcade Today's Posts

Reply
Thread Tools Display Modes
Unread 20 Feb 2003, 00:50   #1
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
Encryption

I need to send some sensitive data back to a browser client to return with the next form they submit - why not use sessions, and store it local side? I dont want it remembered - either they use that data there and then, or we forget about it.

Actually the data itself isnt at all important - I just dont want anyone to be able to forge the data.

As such, as a mini "challenge", I've come up with an an algorithm I'd like to test to see how useful it is.

All of these are SQL queries.

Code:
9HfqGFgSr2eIovkO/P5KiEAkbMSNB9uXjMdJTS4gC2zY3y9HzhI5BdqNpzdzreWA

6qg1QRTq+j06YumK4O8Me0UNSeG2ypsqqVDX1fUDIeKa4GrVqkL+wA==

lPRxCP2h3VBQGCR/KxQ6xc5ePtYn4YM6A7WB9vMf7450uTBDQXAbfA==

s2IDJ33uUjTrTcRxgfEQxSAqDfnYD+5O6Sf9bjqOXKw=
(As a hint, those are encrypted first, then base64 encoded)
__________________
#linux : Home of Genius

<idimmu> ok i was chained to a desk with this oriental dude
MT is offline   Reply With Quote
Unread 20 Feb 2003, 01:10   #2
Gayle29uk
Bitch
 
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
Gayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really nice
My immediate thought is why not set up a GPG CGI interface and have someone else worry about the encryption if it's that sensitive?
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
Gayle29uk is offline   Reply With Quote
Unread 20 Feb 2003, 01:14   #3
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
user does something.
server generates form, sticks in encrypted "what to do after submit" information

user either cancels (what to do disappears) or clicks proceed (what to do is decrypted, and done)
__________________
#linux : Home of Genius

<idimmu> ok i was chained to a desk with this oriental dude
MT is offline   Reply With Quote
Unread 20 Feb 2003, 01:27   #4
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
I'm guessing the attacker would not only have this encrypted data, but information about what it might represent, and the ability to generate lots and lots of string.

What stops them being duplicated? Or is the action one-time like digital cash?

Seems better to sign a hash of the message and the time than use encryption, if you just want trusted messages to yourself from the past.
queball is offline   Reply With Quote
Unread 20 Feb 2003, 01:31   #5
pablissimo
Henry Kelly
 
pablissimo's Avatar
 
Join Date: Apr 2000
Posts: 7,374
pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
When you say 'these are all SQL queries' do you mean that they are complete and valid SQL queries that haven't been compressed or had atoms represented in a shorter way or that keywords may have been replaced by short codes?

Or would that be 'too much information'?

Edit:
To be fair, more examples/access to script output would be required imo, if only for the sake of time...

Edit Edit:
Have you got an example/cut down version of the script/algorithm available online so we can 'probe' it?

Last edited by pablissimo; 20 Feb 2003 at 01:41.
pablissimo is offline   Reply With Quote
Unread 20 Feb 2003, 01:31   #6
Gayle29uk
Bitch
 
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
Gayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really nice
Quote:
Originally posted by MT
user does something.
server generates form, sticks in encrypted "what to do after submit" information

user either cancels (what to do disappears) or clicks proceed (what to do is decrypted, and done)
'View Source' gives them the encrypted return data, doing it a few times will give them a statistical universe to work from in breaking the encryption. If you use GPG you don't care if they see the encrypted data or not, it's not gonna get decrypted any time soon

Downside to this is having to write a CGI interface though and given the number of people interested/capable of breaking it is small that's probably not worth the effort

Why not use session cookies? They disappear when the browser window is closed and are only stored in memory so that fits your criteria 'use it now or lose it'. I'm sure you know this though so I'm curious why they won't do.
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
Gayle29uk is offline   Reply With Quote
Unread 20 Feb 2003, 01:39   #7
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
Quote:
Originally posted by Gayle29uk


Why not use session cookies? They disappear when the browser window is closed and are only stored in memory so that fits your criteria 'use it now or lose it'. I'm sure you know this though so I'm curious why they won't do.
No; the server-side session data is kept until it times out.
queball is offline   Reply With Quote
Unread 20 Feb 2003, 01:47   #8
pablissimo
Henry Kelly
 
pablissimo's Avatar
 
Join Date: Apr 2000
Posts: 7,374
pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Quote:
Originally posted by queball
No; the server-side session data is kept until it times out.
Out of interest, what would be the purpose of such an endevour?

And what would stop someone getting to a page where the encrypted 'instruction' has been stored (say in a hidden input field), leaving it a week, then submitting form data and being able to perform the instruction?

Or is that the point?
pablissimo is offline   Reply With Quote
Unread 20 Feb 2003, 01:50   #9
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
Quote:
Originally posted by queball
I'm guessing the attacker would not only have this encrypted data, but information about what it might represent, and the ability to generate lots and lots of string.
Yes
Quote:
What stops them being duplicated? Or is the action one-time like digital cash?
To duplicate them, they would first need to steal a session. With a stolen session, they can do * anyways. Withstanding that, sending the information 100 times simply results in the afflicted account oweing a fkload of money.

Quote:
Seems better to sign a hash of the message and the time than use encryption, if you just want trusted messages to yourself from the past.
Thats an option, wheres the benefit over this?

Quote:
Originally posted by Gayle29uk
[b]'View Source' gives them the encrypted return data, doing it a few times will give them a statistical universe to work from in breaking the encryption. If you use GPG you don't care if they see the encrypted data or not, it's not gonna get decrypted any time soon
Hmm, when I said "come up with", I actually mean "acquired". The algorithm is TEA.

Quote:
How secure is TEA?

Very. There have been no known successful cryptanalyses of TEA. It's believed (by James Massey) to be as secure as the IDEA algorithm, designed by Massey and Xuejia Lai. It uses the same mixed algebraic groups technique as IDEA, but it's very much simpler, hence faster.
__________________
#linux : Home of Genius

<idimmu> ok i was chained to a desk with this oriental dude
MT is offline   Reply With Quote
Unread 20 Feb 2003, 01:59   #10
Gayle29uk
Bitch
 
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
Gayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really nice
Quote:
Originally posted by MT
Hmm, when I said "come up with", I actually mean "acquired". The algorithm is TEA.
Quote:
Tiny Encryption Algorithm (TEA)
TEA is a cryptographic algorithm designed to minimize memory footprint, and maximize speed. However, the cryptographers from Counterpane Systems have discovered three related-key attacks on TEA, the best of which requires only 223 chosen plaintexts and one related key query. The problems arise from the overly simple key schedule. Each TEA key can be found to have three other equivalent keys, as described in a paper by David Wagner, John Kelsey, and Bruce Schneier. This precludes the possibility of using TEA as a hash function. Roger Needham and David Wheeler have proposed extensions to TEA that counter the above attacks.
Original source (with links to details of the breaks) is here.
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
Gayle29uk is offline   Reply With Quote
Unread 20 Feb 2003, 02:02   #11
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
You have sessions anyway?

You've posted TEA encrypted data (how many iterations?), and are asking people to decrypt it without the key?

Quote:
Originally posted by MT

Thats an option, wheres the benefit over this?
Transparency, debugging, the usual. Might not be an advantage if you have dumb customers.

Gayle, that doesn't affect how MT is using it. And that should say 2^23.

Last edited by queball; 20 Feb 2003 at 02:12.
queball is offline   Reply With Quote
Unread 20 Feb 2003, 03:09   #12
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
Ah, I get you - send a hash of the data to the client, and tie the hash to a particular timeframe, storing everything else in sessions.

32 iterations btw.
__________________
#linux : Home of Genius

<idimmu> ok i was chained to a desk with this oriental dude
MT is offline   Reply With Quote
Unread 20 Feb 2003, 04:13   #13
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
That wasn't what I meant by signing, but yeah a hash would do, or a transaction ID, or anything.

By signing I meant the client gets the text of their transaction, SQL with a timestamp or whatever, along with the hash of that, encrypted. Then you get transparency of the transaction for the user, which probably isn't useful.

You'll be doing some sort of signing anyway, otherwise a client could pass a random string and it would get decrypted to something horrible. If you check if it's ok to run you are (approximately) signing/authenticating, so you might as well do it properly.

BUT if you've got sessions use them, it's simpler and easier to model.

Last edited by queball; 20 Feb 2003 at 04:18.
queball is offline   Reply With Quote
Unread 20 Feb 2003, 04:17   #14
W
Gubbish
 
Join Date: Sep 2000
Location: #FoW
Posts: 2,323
W is a jewel in the roughW is a jewel in the roughW is a jewel in the rough
How about simply encrypting a hash of the commands and a secret key, and send it with the commands in plaintext? If the hash matches a command when returned by the form, you execute them, othervise don't.

Nothing stored on the server, apart from the secret key.
__________________
Gubble gubble gubble gubble
W is offline   Reply With Quote
Reply



Forum Jump


All times are GMT +1. The time now is 08:40.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018