Level 33 C++ sourcerer. https://about.me/marek.knapek

  • 4 Posts
  • 12 Comments
Joined 1 year ago
cake
Cake day: June 29th, 2023

help-circle

  • Doesn’t depend on programming language but something with visual debugger. You know that stuff when you can see current line of your source code highlighted, press a key to step into, step over and so on. You can see values inside your variables. You can also change your variables mid-run right form the debugger.

    Because you spend 20% of your time writing bugs and the other 80% debugging them. At least make it pleasant experience (no printf-style debugging).

    Back in the day I was using Turbo Pascal, Delphi, Visual Basic, C#, Java, PHP with Zend, Java Script, today I’m using Visual C++.



  • Yes, I know this. It took me long time to figure this out. My entire life I focused on technical skills / programming / math / logic. As I deemed them most important for the job. I was like: “Hey, if you cannot program, why do you work as programmer (you stupido)?” Only few years ago I realized that even as programmer (as opposed to sales man) you really need those “meh” soft skills. And that they are really important and I should not call them “meh”. I’m very good at solving problems, improving product’s performance, memory consumption, discovering and fixings bugs, security vulnerabilities. But I’m very very bad at communicating my skills and communicating with people in general. I’m not able to politely tell people that theirs idea is bad, I just say “that’s stupid”. And I’m mostly/sometimes right (if I’m not 100% sure, I don’t say anything), but the damage caused by the way I say it is often inreversible. That post of mine about the job interview and CV was half joke and half reality. I just freeze/stutter when I’m asked something that is obvious because it is written I my CV. I’m immediately thinking “Did he not received the CV?” or “Did he not read it?” “Why the fuck is he not prepared for the call? Why are we wasting time asking me what should be obvious because I sent it in advance?” I’m more robot than human. Put me in front of problem and forget to tell me that it is impossible to solve … and I will solve it. But easy small talk … disaster. Communicating what the problem really was … disaster. Communicating how I solved it … disaster. “It was not working before and now it works fine, what the hell do you want from me now?” Yes, I’m very bad in team, in collective. I didn’t know the reason why, but since few years ago I know the root of the problem. It’s not that everybody around me is stupid and don’t know basic stuff (what I consider basic), but me unable to communicate with other humans.


  • The interview starts … the interviewer asks me “Tell me about yourself.” … I respond “Did you receive my CV? I put all important details about me … right there. What questions do you have about my past jobs?” The interviewer encourages me again to tell him about myself, my past projects, etc. … Me: Awkward silence. … Me to myself: Dafuq? Should I read the CV from top to bottom OR WHAT?


  • Yes, but (there is always a but) it does not apply if you implement off-line encryption. Meaning no on-line service encrypting / decrypting attacker provided data (such as SSL / TLS / HTTPS). Meaning if you are running the cipher on your own computer with your own keys / plaintexts / ciphertexts. There is nobody to snoop time differences or power usage differences when using different key / different ciphertext. Then I would suggest this is fine. The only one who can attack you is yourself. In fact, I implemented AES from scratch in C89 language, this source code is at the same time compatible with C++14 constexpr evaluation mode. I also implemented the Serpent cipher, Serpent was an AES candidate back then when there were no AES and Rijndael was not AES yet. The code is on my GitHub page.








  • And that JavaScript has access to cookies, that’s just a basic part of how web browsers work. Lemmy can’t do anything to prevent that.

    Yes and No. Cookies could be accessed by JS on the client. BUT. When the cookie is sent by the server with additional HttpOnly header, then the cookie cannot be accessed from JS. Look at Lemmy GitHub issue, they discuss exactly this. Lemmy server absolutely has power to prevent this.

    Again, Lemmy can’t do anything about that. Once there’s a vulnerability that allows an attacker to inject arbitrary JS into the site, Lemmy can’t do anything to prevent that JS from making requests.

    I believe they can. But I’m not sure about this one. The server could send a response preventing the web browser to request content from other domains. Banks are using this. There was an attack years ago when attacker created a web page with i-frame in it. The i-frame was full screen to confuse the victim it is actually using the Banks site and not the attacker site. The bank web site was inside the inner i-frame, the code in the outer frame then had access to sensitive data in the inner frame. I believe there are HTTP response headers that instruct the web browser to not allow this. But I’m not sure I remember how exactly this works.

    completely independent backend

    Yes, it would be more costly, but more secure. It is trade-off, which one is more important to you? In case of chat/blog/forum app such as Lemmy I prefer cheap, in case of my Bank website I prefer secure.



  • So what happened:

    • Someone posted a post.
    • The post contained some instruction to display custom emoji.
    • So far so good.
    • There is a bug in JavaScript (TypeScript) that runs on client’s machine (arbitrary code execution?).
    • The attacker leveraged the bug to grab victim’s JWT (cookie) when the victim visited the page with that post.
    • The attacker used the grabbed JWTs to log-in as victim (some of them were admins) and do bad stuff on the server.

    Am I right?

    I’m old-school developer/programmer and it seems that web is peace of sheet. Basic security stuff violated:

    • User provided content (post using custom emojis) caused havoc when processing (doesn’t matter if on server or on client). This is lack of sanitization of user-provided-data.
    • JavaScript (TypeScript) has access to cookies (and thus JWT). This should be handled by web browser, not JS. In case of log-in, in HTTPS POST request and in case of response of successful log-in, in HTTPS POST response. Then, in case of requesting web page, again, it should be handled in HTTPS GET request. This is lack of using least permissions as possible, JS should not have access to cookies.
    • How the attacker got those JWTs? JavaScript sent them to him? Web browser sent them to him when requesting resources form his server? This is lack of site isolation, one web page should not have access to other domains, requesting data form them or sending data to them.
    • The attacker logged-in as admin and caused havoc. Again, this should not be possible, admins should have normal level of access to the site, exactly the same as normal users do. Then, if they want to administer something, they should log-in using separate username + password into separate log-in form and display completely different web page, not allowing them to do the actions normal users can do. You know, separate UI/applications for users and for admins.

    Am I right? Correct me if I’m wrong.

    Again, web is peace of sheet. This would never happen in desktop/server application. Any of the bullet points above would prevent this from happening. Even if the previous bullet point failed to do its job. Am I too naïve? Maybe.

    Marek.